X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=doc%2FMCollective%2FRPC%2FProgress.html;fp=doc%2FMCollective%2FRPC%2FProgress.html;h=f9e876c94bf4b289d16f6bc5be91985551523fa0;hb=7c9314f502cde8daad23b61d10b24a542e04154a;hp=0000000000000000000000000000000000000000;hpb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/MCollective/RPC/Progress.html b/doc/MCollective/RPC/Progress.html new file mode 100644 index 0000000..f9e876c --- /dev/null +++ b/doc/MCollective/RPC/Progress.html @@ -0,0 +1,490 @@ + + + +
+ + ++Class that shows a progress bar, currently only supports a twirling +progress bar. +
++You can specify a size for the progress bar if you want if you dont it will +use the helper functions to figure out terminal dimensions and draw an +appropriately sized bar +
++p = Progress.new 100.times {|i| print +p.twirl(i+1, 100) + “r“};puts +
++ * [ ==================================================> ] 100 / 100 ++ +
(Not documented)
+ + + ++ # File lib/mcollective/rpc/progress.rb, line 15 +15: def initialize(size=nil) +16: @twirl = ['|', '/', '-', "\\", '|', '/', '-', "\\"] +17: @twirldex = 0 +18: +19: if size +20: @size = size +21: else +22: cols = Util.terminal_dimensions[0] - 22 +23: +24: # Defaults back to old behavior if it +25: # couldn't figure out the size or if +26: # its more than 60 wide +27: if cols <= 0 +28: @size = 0 +29: elsif cols > 60 +30: @size = 60 +31: else +32: @size = cols +33: end +34: end +35: end+
(Not documented)
+ + + ++ # File lib/mcollective/rpc/progress.rb, line 37 +37: def twirl(current, total) +38: # if the size is negative there is just not enough +39: # space on the terminal, return a simpler version +40: return "\r#{current} / #{total}" if @size == 0 +41: +42: if current == total +43: txt = "\r %s [ " % Util.colorize(:green, "*") +44: else +45: txt = "\r %s [ " % Util.colorize(:red, @twirl[@twirldex]) +46: end +47: +48: dashes = ((current.to_f / total) * @size).round +49: +50: dashes.times { txt << "=" } +51: txt << ">" +52: +53: (@size - dashes).times { txt << " " } +54: +55: txt << " ] #{current} / #{total}" +56: +57: @twirldex == 7 ? @twirldex = 0 : @twirldex += 1 +58: +59: return txt +60: end+
Disabled; run with --debug to generate this.
+ +Generated with the Darkfish + Rdoc Generator 1.1.6.
+