Class: RVC::CmdModule

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/rvc/modules.rb

Constant Summary

Constants included from Util

Util::PROGRESS_BAR_LEFT, Util::PROGRESS_BAR_MIDDLE, Util::PROGRESS_BAR_RIGHT, Util::UserError

Instance Method Summary collapse

Methods included from Util

#collect_children, #display_inventory, #err, #interactive?, #lookup, #lookup!, #lookup_single, #lookup_single!, #menu, #progress, #search_path, #single_connection, #system_fg, #tasks, #tcsetpgrp, #terminal_columns

Constructor Details

#initialize(module_name) ⇒ CmdModule

Returns a new instance of CmdModule.



31
32
33
34
35
# File 'lib/rvc/modules.rb', line 31

def initialize module_name
  @module_name = module_name
  @opts = {}
  super()
end

Instance Method Details

#commandsObject



37
38
39
# File 'lib/rvc/modules.rb', line 37

def commands
  @opts.keys
end

#opts(cmd, &b) ⇒ Object



41
42
43
# File 'lib/rvc/modules.rb', line 41

def opts cmd, &b
  @opts[cmd] = b
end

#opts_for(cmd) ⇒ Object



45
46
47
# File 'lib/rvc/modules.rb', line 45

def opts_for cmd
  @opts[cmd]
end

#rvc_alias(cmd, target = nil) ⇒ Object



49
50
51
52
# File 'lib/rvc/modules.rb', line 49

def rvc_alias cmd, target=nil
  target ||= cmd
  RVC::ALIASES[target.to_s] = "#{@module_name}.#{cmd}"
end