Class: ShapeupCli::Commands::Base
- Inherits:
-
Object
- Object
- ShapeupCli::Commands::Base
- Defined in:
- lib/shapeup_cli/commands/base.rb
Direct Known Subclasses
Auth, Comments, ConfigCmd, Cycle, Issues, MyWork, Orgs, Pitches, Scopes, Search, Setup, Tasks
Class Method Summary collapse
-
.metadata ⇒ Object
Override in subclasses to define structured command metadata.
- .run(args) ⇒ Object
Instance Method Summary collapse
- #agent_help? ⇒ Boolean
-
#initialize(args) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(args) ⇒ Base
Returns a new instance of Base.
20 21 22 23 24 25 |
# File 'lib/shapeup_cli/commands/base.rb', line 20 def initialize(args) @mode, remaining = Output.parse_mode(args) @agent_help = @mode == :agent && remaining.include?("--help") remaining.delete("--help") if @agent_help @org_id, @remaining = extract_flags(remaining) end |
Class Method Details
.metadata ⇒ Object
Override in subclasses to define structured command metadata
16 17 18 |
# File 'lib/shapeup_cli/commands/base.rb', line 16 def self. { command: name.split("::").last.downcase, description: "No metadata defined" } end |
.run(args) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/shapeup_cli/commands/base.rb', line 6 def self.run(args) instance = new(args) if instance.agent_help? puts JSON.pretty_generate(instance.class.) else instance.execute end end |
Instance Method Details
#agent_help? ⇒ Boolean
27 28 29 |
# File 'lib/shapeup_cli/commands/base.rb', line 27 def agent_help? @agent_help end |