Module: Trustworthy::CLI::Crypt
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
4 5 6 |
# File 'lib/trustworthy/cli/crypt.rb', line 4 def self.included(klass) klass.extend(ClassMethods) end |
Instance Method Details
#_check_options(args) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/trustworthy/cli/crypt.rb', line 32 def (args) = (args) unless [:input_file] && [:output_file] print_help throw :error end end |
#_command ⇒ Object
28 29 30 |
# File 'lib/trustworthy/cli/crypt.rb', line 28 def _command self.class._command end |
#parse_options(args) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/trustworthy/cli/crypt.rb', line 8 def (args) = super(_command, args) do |opts, | opts.on('-o', '--output FILE', "File to write #{_command}ed contents to") do |file| [:output_file] = file end end [:input_file] = args.shift end |
#run(args) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/trustworthy/cli/crypt.rb', line 18 def run(args) catch(:error) do = (args) prompt = Trustworthy::Prompt.new([:config_file], $terminal) File.open([:input_file], 'rb') do |input_file| _transform(prompt, , input_file) end end end |