diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 01:09:50 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 01:09:50 +0000 |
commit | 3a7ac1e04361e12ddfcbf344e9e1db82fb88157b (patch) | |
tree | 166d452836a474541e1054f77b0b586bbe68dd6e /etc | |
parent | 0b61b577f5d65a9c8bd5e690c4010c1e28b70e66 (diff) | |
download | luasocket-3a7ac1e04361e12ddfcbf344e9e1db82fb88157b.tar.gz luasocket-3a7ac1e04361e12ddfcbf344e9e1db82fb88157b.tar.bz2 luasocket-3a7ac1e04361e12ddfcbf344e9e1db82fb88157b.zip |
Changed the naming convention of the mime module.
Looks beautiful.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/get.lua | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/etc/get.lua b/etc/get.lua index 9f29a51..d6760b8 100644 --- a/etc/get.lua +++ b/etc/get.lua | |||
@@ -19,7 +19,7 @@ function nicetime(s) | |||
19 | end | 19 | end |
20 | end | 20 | end |
21 | end | 21 | end |
22 | if l == "s" then return string.format("%2.0f%s", s, l) | 22 | if l == "s" then return string.format("%5.0f%s", s, l) |
23 | else return string.format("%5.2f%s", s, l) end | 23 | else return string.format("%5.2f%s", s, l) end |
24 | end | 24 | end |
25 | 25 | ||
@@ -42,20 +42,16 @@ function nicesize(b) | |||
42 | end | 42 | end |
43 | 43 | ||
44 | -- returns a string with the current state of the download | 44 | -- returns a string with the current state of the download |
45 | local remaining_s = "%s received, %s/s throughput, %2.0f%% done, %s remaining" | ||
46 | local elapsed_s = "%s received, %s/s throughput, %s elapsed " | ||
45 | function gauge(got, delta, size) | 47 | function gauge(got, delta, size) |
46 | local rate = got / delta | 48 | local rate = got / delta |
47 | if size and size >= 1 then | 49 | if size and size >= 1 then |
48 | return string.format("%s received, %s/s throughput, " .. | 50 | return string.format(remaining_s, nicesize(got), nicesize(rate), |
49 | "%.0f%% done, %s remaining", | 51 | 100*got/size, nicetime((size-got)/rate)) |
50 | nicesize(got), | ||
51 | nicesize(rate), | ||
52 | 100*got/size, | ||
53 | nicetime((size-got)/rate)) | ||
54 | else | 52 | else |
55 | return string.format("%s received, %s/s throughput, %s elapsed", | 53 | return string.format(elapsed_s, nicesize(got), |
56 | nicesize(got), | 54 | nicesize(rate), nicetime(delta)) |
57 | nicesize(rate), | ||
58 | nicetime(delta)) | ||
59 | end | 55 | end |
60 | end | 56 | end |
61 | 57 | ||
@@ -78,7 +74,7 @@ function stats(size) | |||
78 | return chunk | 74 | return chunk |
79 | else | 75 | else |
80 | -- close up | 76 | -- close up |
81 | io.stderr:write("\n") | 77 | io.stderr:write("\r", gauge(got, delta), "\n") |
82 | return "" | 78 | return "" |
83 | end | 79 | end |
84 | end | 80 | end |