module Ronin::CLI::KeyOptions
Adds the ‘–key` and `–key-file` options to a command.
Attributes
key[R]
The key string.
@return [String]
Public Class Methods
included(command)
click to toggle source
Adds the ‘–key` and `–key-file` options to the including command.
@param [Class] command
The command including {KeyOptions}.
# File lib/ronin/cli/key_options.rb, line 31 def self.included(command) command.option :key, short: '-k', value: { type: String, usage: 'STRING' }, desc: 'The key String' do |string| @key = string end command.option :key_file, short: '-K', value: { type: String, usage: 'FILE' }, desc: 'The key file' do |path| @key = File.binread(path) rescue Errno::ENOENT raise(OptionParser::InvalidArgument,"no such file or directory: #{path.inspect}") end end