Class: VMC::Cli::Command::FileWithPercentOutput
- Defined in:
- lib/cli/commands/apps.rb
Class Attribute Summary collapse
-
.display_str ⇒ Object
Returns the value of attribute display_str.
-
.upload_size ⇒ Object
Returns the value of attribute upload_size.
Instance Method Summary collapse
Class Attribute Details
.display_str ⇒ Object
Returns the value of attribute display_str.
1104 1105 1106 |
# File 'lib/cli/commands/apps.rb', line 1104 def display_str @display_str end |
.upload_size ⇒ Object
Returns the value of attribute upload_size.
1104 1105 1106 |
# File 'lib/cli/commands/apps.rb', line 1104 def upload_size @upload_size end |
Instance Method Details
#read(*args) ⇒ Object
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 |
# File 'lib/cli/commands/apps.rb', line 1118 def read(*args) result = super(*args) if result && result.size > 0 update_display(result.size) else unless VMC::Cli::Config.output.nil? || !STDOUT.tty? clear(FileWithPercentOutput.display_str.size + 5) VMC::Cli::Config.output.print(FileWithPercentOutput.display_str) display('OK'.green) end end result end |
#update_display(rsize) ⇒ Object
1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 |
# File 'lib/cli/commands/apps.rb', line 1107 def update_display(rsize) @read ||= 0 @read += rsize p = (@read * 100 / FileWithPercentOutput.upload_size).to_i unless VMC::Cli::Config.output.nil? || !STDOUT.tty? clear(FileWithPercentOutput.display_str.size + 5) VMC::Cli::Config.output.print("#{FileWithPercentOutput.display_str} #{p}%") VMC::Cli::Config.output.flush end end |