Class: Fasti::CLI
- Inherits:
-
Object
- Object
- Fasti::CLI
- Defined in:
- lib/fasti/cli.rb
Overview
Command-line interface for the fasti calendar application.
This class handles all CLI functionality including option parsing, validation, and calendar generation. It supports various display formats and customization options while maintaining backwards compatibility.
## Usage Positional arguments for month/year specification:
-
0 args: current month + current year
-
1 arg: 1-12 → month + current year, 13+ → current month + year
-
2 args: month year (first arg = month 1-12, second arg = year)
## Options
-
‘–format, -f`: Display format (month/quarter/year, default: month)
-
‘–start-of-week, -w`: Week start (sunday/monday, default: sunday)
-
‘–country, -c`: Country code for holidays (auto-detected from LANG/LC_ALL, supports many countries)
-
‘–style, -s`: Custom styling for different day types (e.g., “sunday:bold holiday:foreground=red”)
-
‘–version, -v`: Show version information
-
‘–help, -h`: Show help message
## Configuration File Default options can be specified in a configuration file:
-
Path: ‘$XDG_CONFIG_HOME/fasti/config.rb` (or `$HOME/.config/fasti/config.rb` if XDG_CONFIG_HOME is unset)
-
Format: Ruby DSL using Fasti.configure block
-
Precedence: Command line options override config file options
Class Method Summary collapse
-
.run(argv) ⇒ Object
Runs the CLI with the specified arguments.
Instance Method Summary collapse
-
#run(argv) ⇒ Object
Runs the CLI instance with the specified arguments.
Class Method Details
.run(argv) ⇒ Object
Runs the CLI with the specified arguments.
67 68 69 |
# File 'lib/fasti/cli.rb', line 67 def self.run(argv) new.run(argv) end |
Instance Method Details
#run(argv) ⇒ Object
Runs the CLI instance with the specified arguments.
74 75 76 77 78 79 80 81 82 |
# File 'lib/fasti/cli.rb', line 74 def run(argv) @current_time = Time.now # Single source of truth for time catch(:early_exit) do month, year, = parse_arguments(argv) generate_calendar(month, year, ) end rescue => e handle_error(e) end |