Class: Ironclad::CLI
- Inherits:
-
Object
- Object
- Ironclad::CLI
- Defined in:
- lib/ironclad/cli.rb
Overview
Command-line entry point. Dependency-free arg parsing keeps boot cheap and avoids loading Rails just to print a key.
ironclad [env] [--refresh] print the credentials key (default env)
ironclad edit [env] edit Rails credentials for env
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
16 17 18 |
# File 'lib/ironclad/cli.rb', line 16 def initialize(argv) @argv = argv.dup end |
Class Method Details
.start(argv) ⇒ Object
12 13 14 |
# File 'lib/ironclad/cli.rb', line 12 def self.start(argv) new(argv).run end |
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ironclad/cli.rb', line 20 def run case @argv.first when 'edit' @argv.shift edit(@argv.shift || 'default') when '-h', '--help', 'help' print_help else print_key end 0 rescue Error => e warn e. 1 end |