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
ironclad diff <file> git textconv: decrypt a credentials file
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.
17 18 19 |
# File 'lib/ironclad/cli.rb', line 17 def initialize(argv) @argv = argv.dup end |
Class Method Details
.start(argv) ⇒ Object
13 14 15 |
# File 'lib/ironclad/cli.rb', line 13 def self.start(argv) new(argv).run end |
Instance Method Details
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ironclad/cli.rb', line 21 def run case @argv.first when 'edit' @argv.shift edit(@argv.shift || 'default') when 'diff' @argv.shift diff(@argv.shift) when '-h', '--help', 'help' print_help else print_key end 0 rescue Error => e warn e. 1 end |