class KBSecret::CLI::Command::Help
The implementation of `kbsecret help`.
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
KBSecret::CLI::Command::Abstract::new
# File lib/kbsecret/cli/command/help.rb, line 8 def initialize(argv) super(argv) do |cli| cli.slop do |o| o.banner = <<~HELP Usage: kbsecret help <command> For a list of all commands, see: kbsecret help HELP end cli.dreck errors: false do string :command end end end
Public Instance Methods
run!()
click to toggle source
# File lib/kbsecret/cli/command/help.rb, line 41 def run! command = cli.args[:command] if command.empty? puts toplevel_help elsif Command.internal?(command) Command.run! command, "--help" elsif Command.external?(command) cli.die "Help is not available for external commands." else cli.die "Unknown command: #{command}." end end
toplevel_help()
click to toggle source
@return [String] the top-level “help” string for `kbsecret`
# File lib/kbsecret/cli/command/help.rb, line 27 def toplevel_help <<~KBSECRET_HELP Usage: kbsecret <command> <args ...> Available commands: #{Command.all_command_names.join(", ")} For more information about a particular command, try: kbsecret help <command> KBSECRET_HELP end