Module: Bashly::Script::Introspection::Arguments
- Included in:
- Command
- Defined in:
- lib/bashly/script/introspection/arguments.rb
Instance Method Summary collapse
-
#args ⇒ Object
Returns an array of Arguments.
-
#default_args ⇒ Object
Returns an array of all the default Args.
-
#repeatable_arg_exist? ⇒ Boolean
Returns true if one of the args is repeatable.
-
#required_args ⇒ Object
Returns an array of all the required Arguments.
-
#usage_string_args ⇒ Object
Returns an array of args usage_string for the command’s usage_string.
-
#whitelisted_args ⇒ Object
Returns an array of all the args with a whitelist.
Instance Method Details
#args ⇒ Object
Returns an array of Arguments
6 7 8 9 10 11 12 |
# File 'lib/bashly/script/introspection/arguments.rb', line 6 def args return [] unless ['args'] ['args'].map do || Argument.new end end |
#default_args ⇒ Object
Returns an array of all the default Args
15 16 17 |
# File 'lib/bashly/script/introspection/arguments.rb', line 15 def default_args args.select(&:default) end |
#repeatable_arg_exist? ⇒ Boolean
Returns true if one of the args is repeatable
20 21 22 |
# File 'lib/bashly/script/introspection/arguments.rb', line 20 def repeatable_arg_exist? args.any?(&:repeatable) end |
#required_args ⇒ Object
Returns an array of all the required Arguments
25 26 27 |
# File 'lib/bashly/script/introspection/arguments.rb', line 25 def required_args args.select(&:required) end |
#usage_string_args ⇒ Object
Returns an array of args usage_string for the command’s usage_string
30 31 32 |
# File 'lib/bashly/script/introspection/arguments.rb', line 30 def usage_string_args args.map(&:usage_string) end |
#whitelisted_args ⇒ Object
Returns an array of all the args with a whitelist
35 36 37 |
# File 'lib/bashly/script/introspection/arguments.rb', line 35 def whitelisted_args args.select(&:allowed) end |