Class: HammerCLIForemanRemoteExecution::Options::Normalizers::KeyFileList

Inherits:
HammerCLI::Options::Normalizers::KeyValueList
  • Object
show all
Defined in:
lib/hammer_cli_foreman_remote_execution/options/normalizers.rb

Instance Method Summary collapse

Instance Method Details

#complete(value) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/hammer_cli_foreman_remote_execution/options/normalizers.rb', line 13

def complete(value)
  Dir[value.to_s+'*'].collect do |file|
    if ::File.directory?(file)
      file+'/'
    else
      file+' '
    end
  end
end

#descriptionObject



5
6
7
# File 'lib/hammer_cli_foreman_remote_execution/options/normalizers.rb', line 5

def description
  _('Comma-separated list of key=file, where file is a path to a text file to be read')
end

#format(val) ⇒ Object



9
10
11
# File 'lib/hammer_cli_foreman_remote_execution/options/normalizers.rb', line 9

def format(val)
  Hash[super.map { |key, path| [key, ::File.read(::File.expand_path(path))] }]
end