Class: MtgCardMaker::CLI
- Inherits:
-
Thor
- Object
- Thor
- MtgCardMaker::CLI
- Defined in:
- lib/mtg_card_maker/cli.rb
Overview
Thor-based command-line interface for MTG Card Maker. Provides commands for generating individual cards and sprite sheets from YAML configuration files.
Class Method Summary collapse
-
.card_options ⇒ Hash
Define the standard card options for CLI commands.
- .exit_on_failure? ⇒ Boolean
Instance Method Summary collapse
-
#add_card(yaml_file) ⇒ Object
Add a new card configuration to YAML file.
-
#generate_card ⇒ Object
Generate a single MTG card with specified parameters.
-
#generate_sprite(yaml_file, output_file) ⇒ Object
Generate a sprite sheet from YAML configuration.
Class Method Details
.card_options ⇒ Hash
Define the standard card options for CLI commands
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/mtg_card_maker/cli.rb', line 40 def self. { name: { type: :string, required: true, desc: 'Card name' }, mana_cost: { type: :string, aliases: ['mana', 'cost'], desc: 'Mana cost (e.g., "2RR", "XG")' }, type_line: { type: :string, required: true, aliases: ['type'], desc: 'Card type & subtype (e.g., "Creature - Dragon", "Instant")' }, rules_text: { type: :string, required: true, aliases: ['rules'], desc: 'Card rules text' }, flavor_text: { type: :string, aliases: ['flavor'], desc: 'Flavor text (optional)' }, power: { type: :string, desc: 'Power (for creatures)' }, toughness: { type: :string, desc: 'Toughness (for creatures)' }, border_color: { type: :string, aliases: ['border'], desc: 'Border color (white, black, gold, silver)' }, color: { type: :string, default: 'colorless', desc: 'Card color (white, blue, black, red, green, colorless)' }, art: { type: :string, aliases: ['artwork', 'image'], desc: 'Image URL or path for card artwork' } } end |
.exit_on_failure? ⇒ Boolean
33 34 35 |
# File 'lib/mtg_card_maker/cli.rb', line 33 def self.exit_on_failure? true end |
Instance Method Details
#add_card(yaml_file) ⇒ Object
Add a new card configuration to YAML file
107 |
# File 'lib/mtg_card_maker/cli.rb', line 107 desc 'add_card YAML_FILE [OPTIONS]', 'Add a new card configuration to YAML file' |
#generate_card ⇒ Object
Generate a single MTG card with specified parameters
74 |
# File 'lib/mtg_card_maker/cli.rb', line 74 desc 'generate_card [OPTIONS]', 'Generate a single MTG card with specified parameters' |
#generate_sprite(yaml_file, output_file) ⇒ Object
Generate a sprite sheet from YAML configuration
88 |
# File 'lib/mtg_card_maker/cli.rb', line 88 desc 'generate_sprite YAML_FILE OUTPUT_FILE [OPTIONS]', 'Generate a sprite sheet from YAML configuration' |