Class: Commander::Command
- Inherits:
-
Object
- Object
- Commander::Command
- Defined in:
- lib/MrMurano/ReCommander.rb
Instance Attribute Summary collapse
-
#must_not_be_managed ⇒ Object
A command sets must_not_be_managed if its use is restricted to unmanaged solutions.
-
#project_not_required ⇒ Object
A command sets project_not_required if it can run from without a project directory.
-
#prompt_if_logged_off ⇒ Object
A command sets prompt_if_logged_off if it is okay to ask the user for their password.
-
#restrict_to_cur_dir ⇒ Object
A command sets restrict_to_cur_dir if it should not climb the directory hierarchy in search of a .murano/config file.
-
#subcmdgrouphelp ⇒ Object
A command sets subcmdgrouphelp if it’s help.
Instance Method Summary collapse
Instance Attribute Details
#must_not_be_managed ⇒ Object
A command sets must_not_be_managed if its use is restricted to unmanaged solutions.
57 58 59 |
# File 'lib/MrMurano/ReCommander.rb', line 57 def must_not_be_managed @must_not_be_managed end |
#project_not_required ⇒ Object
A command sets project_not_required if it can run from without a project directory.
45 46 47 |
# File 'lib/MrMurano/ReCommander.rb', line 45 def project_not_required @project_not_required end |
#prompt_if_logged_off ⇒ Object
A command sets prompt_if_logged_off if it is okay to ask the user for their password.
52 53 54 |
# File 'lib/MrMurano/ReCommander.rb', line 52 def prompt_if_logged_off @prompt_if_logged_off end |
#restrict_to_cur_dir ⇒ Object
A command sets restrict_to_cur_dir if it should not climb the directory hierarchy in search of a .murano/config file.
49 50 51 |
# File 'lib/MrMurano/ReCommander.rb', line 49 def restrict_to_cur_dir @restrict_to_cur_dir end |
#subcmdgrouphelp ⇒ Object
A command sets subcmdgrouphelp if it’s help.
54 55 56 |
# File 'lib/MrMurano/ReCommander.rb', line 54 def subcmdgrouphelp @subcmdgrouphelp end |
Instance Method Details
#verify_arg_count!(args, max_args = 0, mandatory = []) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/MrMurano/ReCommander.rb', line 59 def verify_arg_count!(args, max_args=0, mandatory=[]) if !max_args.nil? && max_args.zero? if args.count > 0 MrMurano::Verbose.error('Not expecting any arguments') exit 2 end elsif !max_args.nil? && args.count > max_args MrMurano::Verbose.error("Not expecting more than #{max_args} arguments") exit 2 elsif args.count < mandatory.length (args.count..(mandatory.length - 1)).to_a.each do |ix| MrMurano::Verbose.error(mandatory[ix]) end exit 2 end end |