Class: Resumer::CLI
- Inherits:
-
Object
- Object
- Resumer::CLI
- Includes:
- Commander::Methods
- Defined in:
- lib/resumer.rb
Overview
Commander CLI interface
Instance Method Summary collapse
-
#add_export_command ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
-
#run ⇒ Object
rubocop:enable Metrics/MethodLength.
Constructor Details
permalink #initialize ⇒ CLI
Returns a new instance of CLI.
15 16 17 18 19 20 21 |
# File 'lib/resumer.rb', line 15 def initialize program :name, Resumer::PKG program :version, Resumer::VERSION program :description, Resumer::DESCRIPTION program :help_formatter, :compact program :help, *Resumer::AUTHOR end |
Instance Method Details
permalink #add_export_command ⇒ Object
rubocop:disable Metrics/MethodLength
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/resumer.rb', line 24 def add_export_command command :export do |c| c.option '-c', '--config FILE', 'Load a custom configuration file' c.option '--format STRING', 'Destination format (HTML or PDF)' c.summary = 'Export a YAML resume to HTML or PDF format' c.syntax = "#{Resumer::BIN} export <source.yml> [destination.html|.pdf]" c.action do |args, | Resumer::Command::Export.new(args, ).run rescue StandardError => e say "Error (#{e.class.name}): #{e.}" exit 1 end end end |
permalink #run ⇒ Object
rubocop:enable Metrics/MethodLength
40 41 42 43 44 45 46 47 |
# File 'lib/resumer.rb', line 40 def run default_command :usage add_command(Resumer::Command::Usage.new) add_command(Resumer::Command::Init.new) add_command(Resumer::Command::Validate.new) add_export_command run! end |