Class: Elasticshell::Commands::Df

Inherits:
Elasticshell::Command show all
Defined in:
lib/elasticshell/commands/df.rb

Instance Attribute Summary

Attributes inherited from Elasticshell::Command

#input, #shell

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Elasticshell::Command

#be_connected!, #initialize

Constructor Details

This class inherits a constructor from Elasticshell::Command

Class Method Details

.matches?(input) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/elasticshell/commands/df.rb', line 5

def self.matches? input
  input =~ /^df/i
end

Instance Method Details

#evaluate!Object



9
10
11
12
13
14
15
16
17
# File 'lib/elasticshell/commands/df.rb', line 9

def evaluate!
  be_connected!
  global = shell.scope_from_path("/")
  global.status["indices"].each_pair do |index_name, data|
    size       = data["index"]["size_in_bytes"]
    human_size = data["index"]["size"]
    shell.print("%6s %6s \e[32m%s\e[0m" % [size, human_size, index_name])
  end
end