Class: CLI::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/shell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd) ⇒ Shell

Returns a new instance of Shell.



13
14
15
16
17
18
19
20
21
# File 'lib/cli/shell.rb', line 13

def initialize(cmd)
  cmd_shell = Psych.load_file(File.join(__dir__, 'help.yml'))[cmd]
  @usage = ["Usage: #{cmd_shell['usage']}\n"]
  @options = nil
  @usage << load_options(cmd_shell['options'])
  @path = Dir.pwd
  @target = target_directory @path
  @session = false
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



11
12
13
# File 'lib/cli/shell.rb', line 11

def options
  @options
end

#pathObject

Returns the value of attribute path.



10
11
12
# File 'lib/cli/shell.rb', line 10

def path
  @path
end

#sessionObject

Returns the value of attribute session.



10
11
12
# File 'lib/cli/shell.rb', line 10

def session
  @session
end

#targetObject

Returns the value of attribute target.



11
12
13
# File 'lib/cli/shell.rb', line 11

def target
  @target
end

Instance Method Details



23
24
25
# File 'lib/cli/shell.rb', line 23

def print_help
  puts @usage
end