Class: Envo::CmdPath
- Inherits:
-
Object
- Object
- Envo::CmdPath
- Defined in:
- lib/envo/cmd_path.rb
Constant Summary collapse
- Name =
'path'
Class Method Summary collapse
- .parse_cli(args) ⇒ Object
- .parse_script(tokens, opts) ⇒ Object
- .register_cli_parser(parser) ⇒ Object
- .register_help(help) ⇒ Object
- .register_script_parser(parser) ⇒ Object
Class Method Details
.parse_cli(args) ⇒ Object
20 21 22 |
# File 'lib/envo/cmd_path.rb', line 20 def self.parse_cli(args) CmdList.parse_cli(args.unshift('@path')) end |
.parse_script(tokens, opts) ⇒ Object
24 25 26 |
# File 'lib/envo/cmd_path.rb', line 24 def self.parse_script(tokens, opts) CmdList.parse_script(tokens.unshift('@path'), opts) end |
.register_cli_parser(parser) ⇒ Object
11 12 13 14 |
# File 'lib/envo/cmd_path.rb', line 11 def self.register_cli_parser(parser) parser.add_cmd(Name, ->(cmd, args) { parse_cli(args) }) parser.add_cmd('p', ->(cmd, args) { parse_cli(args) }) end |
.register_help(help) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/envo/cmd_path.rb', line 4 def self.register_help(help) help.add_cmd "path <args>", <<~EOF shorthand for 'list @path <args>' shorthand: 'p' EOF end |
.register_script_parser(parser) ⇒ Object
16 17 18 |
# File 'lib/envo/cmd_path.rb', line 16 def self.register_script_parser(parser) parser.add_cmd(Name, ->(cmd, tokens, opts) { parse_script(tokens, opts) }) end |