Class: Harnex::Recipes
- Inherits:
-
Object
- Object
- Harnex::Recipes
- Defined in:
- lib/harnex/commands/recipes.rb
Constant Summary collapse
- RECIPES_DIR =
File.("../../../../recipes", __FILE__)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Recipes
constructor
A new instance of Recipes.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ Recipes
Returns a new instance of Recipes.
32 33 34 |
# File 'lib/harnex/commands/recipes.rb', line 32 def initialize(argv) @argv = argv.dup end |
Class Method Details
.usage ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/harnex/commands/recipes.rb', line 7 def self.usage <<~TEXT Usage: harnex recipes [list|show <name>] Subcommands: list List available recipes (default) show <name> Print a recipe by name or number Examples: harnex recipes harnex recipes list harnex recipes show 01 harnex recipes show fire_and_watch Common patterns: harnex recipes show 01 # Fire and Watch harnex recipes show 02 # Chain Implement harnex recipes show 03 # Buddy Gotchas: Recipes are compact command walkthroughs. Use `harnex agents-guide` for the deeper agent-facing guide. TEXT end |
Instance Method Details
#run ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/harnex/commands/recipes.rb', line 36 def run subcommand = @argv.shift case subcommand when nil, "list" list_recipes when "show" show_recipe(@argv.first) when "-h", "--help" puts self.class.usage 0 else # Treat bare arg as show show_recipe(subcommand) end end |