brew/Library/Homebrew/sorbet/rbi/gems/commander@4.6.0.rbi

1244 lines
37 KiB
Plaintext
Raw Normal View History

# typed: true
2021-02-15 06:57:26 +00:00
# DO NOT EDIT MANUALLY
2021-04-23 05:59:48 +00:00
# This is an autogenerated file for types exported from the `commander` gem.
2021-09-17 19:28:50 +01:00
# Please instead update this file by running `bin/tapioca gem commander`.
2021-02-15 06:57:26 +00:00
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/core_ext/array.rb#3
class Array
include ::Enumerable
2021-02-15 06:57:26 +00:00
2023-12-14 15:34:15 +00:00
class << self
# Split _string_ into an array. Used in
# conjunction with HighLine's #ask, or #ask_for_array
# methods, which must respond to #parse.
#
# This method allows escaping of whitespace. For example
# the arguments foo bar\ baz will become ['foo', 'bar baz']
#
# === Example
#
# # ask invokes Array#parse
# list = ask 'Favorite cookies:', Array
#
# # or use ask_for_CLASS
# list = ask_for_array 'Favorite cookies: '
#
# source://commander//lib/commander/core_ext/array.rb#21
def parse(string); end
end
end
# source://commander//lib/commander/blank.rb#3
2021-09-10 21:21:17 +01:00
module Blank
class << self
2023-12-14 15:34:15 +00:00
# @private
#
# source://commander//lib/commander/blank.rb#4
2021-09-10 21:21:17 +01:00
def included(base); end
end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/version.rb#3
2021-09-10 21:21:17 +01:00
module Commander
private
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/configure.rb#4
2021-09-10 21:21:17 +01:00
def configure(*configuration_opts, &configuration_block); end
class << self
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/configure.rb#4
2021-09-10 21:21:17 +01:00
def configure(*configuration_opts, &configuration_block); end
end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/command.rb#6
2021-09-10 21:21:17 +01:00
class Commander::Command
2023-12-14 15:34:15 +00:00
# Initialize new command with specified _name_.
#
# @return [Command] a new instance of Command
#
# source://commander//lib/commander/command.rb#40
2021-09-10 21:21:17 +01:00
def initialize(name); end
2023-12-14 15:34:15 +00:00
# Handle execution of command. The handler may be a class,
# object, or block (see examples below).
#
# === Examples
#
# # Simple block handling
# c.when_called do |args, options|
# # do something
# end
#
# # Create inst of Something and pass args / options
# c.when_called MyLib::Command::Something
#
# # Create inst of Something and use arbitrary method
# c.when_called MyLib::Command::Something, :some_method
#
# # Pass an object to handle callback (requires method symbol)
# c.when_called SomeObject, :some_method
#
# source://commander//lib/commander/command.rb#142
2021-09-10 21:21:17 +01:00
def action(*args, &block); end
2023-12-14 15:34:15 +00:00
# Call the commands when_called block with _args_.
#
# source://commander//lib/commander/command.rb#181
2021-09-10 21:21:17 +01:00
def call(args = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute description.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def description; end
2023-12-14 15:34:15 +00:00
# Sets the attribute description
#
# @param value the value to set the attribute description to.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def description=(_arg0); end
2023-12-14 15:34:15 +00:00
# Add a usage example for this command.
#
# Usage examples are later displayed in help documentation
# created by the help formatters.
#
# === Examples
#
# command :something do |c|
# c.example "Should do something", "my_command something"
# end
#
# source://commander//lib/commander/command.rb#59
2021-09-10 21:21:17 +01:00
def example(description, command); end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute examples.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def examples; end
2023-12-14 15:34:15 +00:00
# Sets the attribute examples
#
# @param value the value to set the attribute examples to.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def examples=(_arg0); end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute global_options.
#
# source://commander//lib/commander/command.rb#8
2021-09-10 21:21:17 +01:00
def global_options; end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/command.rb#215
2021-09-10 21:21:17 +01:00
def inspect; end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute name.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def name; end
2023-12-14 15:34:15 +00:00
# Sets the attribute name
#
# @param value the value to set the attribute name to.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def name=(_arg0); end
2023-12-14 15:34:15 +00:00
# Add an option.
#
# Options are parsed via OptionParser so view it
# for additional usage documentation. A block may optionally be
# passed to handle the option, otherwise the _options_ struct seen below
# contains the results of this option. This handles common formats such as:
#
# -h, --help options.help # => bool
# --[no-]feature options.feature # => bool
# --large-switch options.large_switch # => bool
# --file FILE options.file # => file passed
# --list WORDS options.list # => array
# --date [DATE] options.date # => date or nil when optional argument not set
#
# === Examples
#
# command :something do |c|
# c.option '--recursive', 'Do something recursively'
# c.option '--file FILE', 'Specify a file'
# c.option('--info', 'Display info') { puts "handle with block" }
# c.option '--[no-]feature', 'With or without feature'
# c.option '--list FILES', Array, 'List the files specified'
#
# c.when_called do |args, options|
# do_something_recursively if options.recursive
# do_something_with_file options.file if options.file
# end
# end
#
# === Help Formatters
#
# This method also parses the arguments passed in order to determine
# which were switches, and which were descriptions for the
# option which can later be used within help formatters
# using option[:switches] and option[:description].
#
# === Input Parsing
#
# Since Commander utilizes OptionParser you can pre-parse and evaluate
# option arguments. Simply require 'optparse/time', or 'optparse/date', as these
# objects must respond to #parse.
#
# c.option '--time TIME', Time
# c.option '--date [DATE]', Date
#
# source://commander//lib/commander/command.rb#110
2021-09-10 21:21:17 +01:00
def option(*args, &block); end
2023-12-14 15:34:15 +00:00
# Option proxy proc used when a block is not explicitly passed
# via the #option method. This allows commander to auto-populate
# and work with option values.
#
# source://commander//lib/commander/command.rb#211
2021-09-10 21:21:17 +01:00
def option_proc(switches); end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute options.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def options; end
2023-12-14 15:34:15 +00:00
# Sets the attribute options
#
# @param value the value to set the attribute options to.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def options=(_arg0); end
2023-12-14 15:34:15 +00:00
# Parses options and calls associated procs,
# returning the arguments remaining.
#
# source://commander//lib/commander/command.rb#166
2021-09-10 21:21:17 +01:00
def parse_options_and_call_procs(*args); end
2023-12-14 15:34:15 +00:00
# Creates an Options instance populated with the option values
# collected by the #option_proc.
#
# source://commander//lib/commander/command.rb#197
2021-09-10 21:21:17 +01:00
def proxy_option_struct; end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute proxy_options.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def proxy_options; end
2023-12-14 15:34:15 +00:00
# Sets the attribute proxy_options
#
# @param value the value to set the attribute proxy_options to.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def proxy_options=(_arg0); end
2023-12-14 15:34:15 +00:00
# Run the command with _args_.
#
# * parses options, call option blocks
# * invokes when_called proc
#
# source://commander//lib/commander/command.rb#156
2021-09-10 21:21:17 +01:00
def run(*args); end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute summary.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def summary; end
2023-12-14 15:34:15 +00:00
# Sets the attribute summary
#
# @param value the value to set the attribute summary to.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def summary=(_arg0); end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute syntax.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def syntax; end
2023-12-14 15:34:15 +00:00
# Sets the attribute syntax
#
# @param value the value to set the attribute syntax to.
#
# source://commander//lib/commander/command.rb#7
2021-09-10 21:21:17 +01:00
def syntax=(_arg0); end
2023-12-14 15:34:15 +00:00
# Handle execution of command. The handler may be a class,
# object, or block (see examples below).
#
# === Examples
#
# # Simple block handling
# c.when_called do |args, options|
# # do something
# end
#
# # Create inst of Something and pass args / options
# c.when_called MyLib::Command::Something
#
# # Create inst of Something and use arbitrary method
# c.when_called MyLib::Command::Something, :some_method
#
# # Pass an object to handle callback (requires method symbol)
# c.when_called SomeObject, :some_method
#
# source://commander//lib/commander/command.rb#142
2021-09-10 21:21:17 +01:00
def when_called(*args, &block); end
end
2023-12-14 15:34:15 +00:00
# Options struct.
#
# source://commander//lib/commander/command.rb#13
2021-09-10 21:21:17 +01:00
class Commander::Command::Options
include ::Blank
2023-12-14 15:34:15 +00:00
# @return [Options] a new instance of Options
#
# source://commander//lib/commander/command.rb#16
2021-09-10 21:21:17 +01:00
def initialize; end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/command.rb#20
2021-09-10 21:21:17 +01:00
def __hash__; end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/command.rb#28
2021-09-10 21:21:17 +01:00
def default(defaults = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/command.rb#32
2021-09-10 21:21:17 +01:00
def inspect; end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/command.rb#24
2021-09-10 21:21:17 +01:00
def method_missing(meth, *args); end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#4
2021-09-10 21:21:17 +01:00
module Commander::Delegates
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#17
2021-09-10 21:21:17 +01:00
def add_command(*args, &block); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#17
2021-09-10 21:21:17 +01:00
def alias_command(*args, &block); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#17
2021-09-10 21:21:17 +01:00
def always_trace!(*args, &block); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#17
2021-09-10 21:21:17 +01:00
def command(*args, &block); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#17
2021-09-10 21:21:17 +01:00
def default_command(*args, &block); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#23
2021-09-10 21:21:17 +01:00
def defined_commands(*args, &block); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#17
2021-09-10 21:21:17 +01:00
def global_option(*args, &block); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#17
2021-09-10 21:21:17 +01:00
def never_trace!(*args, &block); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#17
2021-09-10 21:21:17 +01:00
def program(*args, &block); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/delegates.rb#17
2021-09-10 21:21:17 +01:00
def run!(*args, &block); end
end
2023-12-14 15:34:15 +00:00
# = Help Formatter
#
# Commander's help formatters control the output when
# either the help command, or --help switch are called.
# The default formatter is Commander::HelpFormatter::Terminal.
#
# source://commander//lib/commander/help_formatters.rb#4
2021-09-10 21:21:17 +01:00
module Commander::HelpFormatter
private
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters.rb#47
2021-09-10 21:21:17 +01:00
def indent(amount, text); end
class << self
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters.rb#47
2021-09-10 21:21:17 +01:00
def indent(amount, text); end
end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters/base.rb#12
2021-09-10 21:21:17 +01:00
class Commander::HelpFormatter::Base
2023-12-14 15:34:15 +00:00
# @return [Base] a new instance of Base
#
# source://commander//lib/commander/help_formatters/base.rb#13
2021-09-10 21:21:17 +01:00
def initialize(runner); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters/base.rb#17
2021-09-10 21:21:17 +01:00
def render; end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters/base.rb#21
2021-09-10 21:21:17 +01:00
def render_command(command); end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters.rb#9
2021-09-10 21:21:17 +01:00
class Commander::HelpFormatter::Context
2023-12-14 15:34:15 +00:00
# @return [Context] a new instance of Context
#
# source://commander//lib/commander/help_formatters.rb#10
2021-09-10 21:21:17 +01:00
def initialize(target); end
2023-12-14 15:34:15 +00:00
# No-op, override in subclasses.
#
# source://commander//lib/commander/help_formatters.rb#21
2021-09-10 21:21:17 +01:00
def decorate_binding(_bind); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters.rb#14
2021-09-10 21:21:17 +01:00
def get_binding; end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters.rb#25
2021-09-10 21:21:17 +01:00
class Commander::HelpFormatter::ProgramContext < ::Commander::HelpFormatter::Context
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters.rb#26
2021-09-10 21:21:17 +01:00
def decorate_binding(bind); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters.rb#35
2021-09-10 21:21:17 +01:00
def max_aliases_length(bind); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters.rb#31
2021-09-10 21:21:17 +01:00
def max_command_length(bind); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters.rb#39
2021-09-10 21:21:17 +01:00
def max_key_length(hash, default = T.unsafe(nil)); end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters/terminal.rb#7
2021-09-10 21:21:17 +01:00
class Commander::HelpFormatter::Terminal < ::Commander::HelpFormatter::Base
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters/terminal.rb#8
2021-09-10 21:21:17 +01:00
def render; end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters/terminal.rb#12
2021-09-10 21:21:17 +01:00
def render_command(command); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters/terminal.rb#16
2021-09-10 21:21:17 +01:00
def template(name); end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters/terminal_compact.rb#7
2021-09-10 21:21:17 +01:00
class Commander::HelpFormatter::TerminalCompact < ::Commander::HelpFormatter::Terminal
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/help_formatters/terminal_compact.rb#8
2021-09-10 21:21:17 +01:00
def template(name); end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/methods.rb#4
2021-09-10 21:21:17 +01:00
module Commander::Methods
include ::Commander::UI
include ::Commander::UI::AskForClass
include ::Commander::Delegates
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/platform.rb#4
2021-09-10 21:21:17 +01:00
module Commander::Platform
class << self
2023-12-14 15:34:15 +00:00
# @return [Boolean]
#
# source://commander//lib/commander/platform.rb#5
2021-09-10 21:21:17 +01:00
def jruby?; end
end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/runner.rb#6
2021-09-10 21:21:17 +01:00
class Commander::Runner
2023-12-14 15:34:15 +00:00
# Initialize a new command runner. Optionally
# supplying _args_ for mocking, or arbitrary usage.
#
# @return [Runner] a new instance of Runner
#
# source://commander//lib/commander/runner.rb#21
2021-09-10 21:21:17 +01:00
def initialize(args = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Get active command within arguments passed to this runner.
#
# source://commander//lib/commander/runner.rb#223
2021-09-10 21:21:17 +01:00
def active_command; end
2023-12-14 15:34:15 +00:00
# Add a command object to this runner.
#
# source://commander//lib/commander/runner.rb#200
2021-09-10 21:21:17 +01:00
def add_command(command); end
2023-12-14 15:34:15 +00:00
# Check if command _name_ is an alias.
#
# @return [Boolean]
#
# source://commander//lib/commander/runner.rb#207
2021-09-10 21:21:17 +01:00
def alias?(name); end
2023-12-14 15:34:15 +00:00
# Alias command _name_ with _alias_name_. Optionally _args_ may be passed
# as if they were being passed straight to the original command via the command-line.
#
# source://commander//lib/commander/runner.rb#184
2021-09-10 21:21:17 +01:00
def alias_command(alias_name, name, *args); end
2023-12-14 15:34:15 +00:00
# Enable tracing on all executions (bypasses --trace)
#
# source://commander//lib/commander/runner.rb#89
2021-09-10 21:21:17 +01:00
def always_trace!; end
2023-12-14 15:34:15 +00:00
# Return arguments without the command name.
#
# source://commander//lib/commander/runner.rb#255
2021-09-10 21:21:17 +01:00
def args_without_command_name; end
2023-12-14 15:34:15 +00:00
# Creates and yields a command instance when a block is passed.
# Otherwise attempts to return the command, raising InvalidCommandError when
# it does not exist.
#
# === Examples
#
# command :my_command do |c|
# c.when_called do |args|
# # Code
# end
# end
#
# @yield [add_command(Commander::Command.new(name))]
#
# source://commander//lib/commander/runner.rb#161
2021-09-10 21:21:17 +01:00
def command(name, &block); end
2023-12-14 15:34:15 +00:00
# Check if a command _name_ exists.
#
# @return [Boolean]
#
# source://commander//lib/commander/runner.rb#214
2021-09-10 21:21:17 +01:00
def command_exists?(name); end
2023-12-14 15:34:15 +00:00
# Attempts to locate a command name from within the arguments.
# Supports multi-word commands, using the largest possible match.
# Returns the default command, if no valid commands found in the args.
#
# source://commander//lib/commander/runner.rb#232
2021-09-10 21:21:17 +01:00
def command_name_from_args; end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute commands.
#
# source://commander//lib/commander/runner.rb#15
2021-09-10 21:21:17 +01:00
def commands; end
2023-12-14 15:34:15 +00:00
# Creates default commands such as 'help' which is
# essentially the same as using the --help switch.
#
# source://commander//lib/commander/runner.rb#287
2021-09-10 21:21:17 +01:00
def create_default_commands; end
2023-12-14 15:34:15 +00:00
# Default command _name_ to be used when no other
# command is found in the arguments.
#
# source://commander//lib/commander/runner.rb#193
2021-09-10 21:21:17 +01:00
def default_command(name); end
2023-12-14 15:34:15 +00:00
# expand switches of the style '--[no-]blah' into both their
# '--blah' and '--no-blah' variants, so that they can be
# properly detected and removed
#
# source://commander//lib/commander/runner.rb#358
2021-09-10 21:21:17 +01:00
def expand_optionally_negative_switches(switches); end
2023-12-14 15:34:15 +00:00
# Add a global option; follows the same syntax as Command#option
# This would be used for switches such as --version, --trace, etc.
#
# source://commander//lib/commander/runner.rb#170
2021-09-10 21:21:17 +01:00
def global_option(*args, &block); end
2023-12-14 15:34:15 +00:00
# Returns a proc allowing for commands to inherit global options.
# This functionality works whether a block is present for the global
# option or not, so simple switches such as --verbose can be used
# without a block, and used throughout all commands.
#
# source://commander//lib/commander/runner.rb#393
2021-09-10 21:21:17 +01:00
def global_option_proc(switches, &block); end
2023-12-14 15:34:15 +00:00
# Help formatter instance.
#
# source://commander//lib/commander/runner.rb#248
2021-09-10 21:21:17 +01:00
def help_formatter; end
2023-12-14 15:34:15 +00:00
# Returns hash of help formatter alias defaults.
#
# source://commander//lib/commander/runner.rb#266
2021-09-10 21:21:17 +01:00
def help_formatter_alias_defaults; end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute help_formatter_aliases.
#
# source://commander//lib/commander/runner.rb#15
2021-09-10 21:21:17 +01:00
def help_formatter_aliases; end
2023-12-14 15:34:15 +00:00
# Hide the trace option from the help menus and don't add it as a global option
#
# source://commander//lib/commander/runner.rb#97
2021-09-10 21:21:17 +01:00
def never_trace!; end
2023-12-14 15:34:15 +00:00
# Returns the value of attribute options.
#
# source://commander//lib/commander/runner.rb#15
2021-09-10 21:21:17 +01:00
def options; end
2023-12-14 15:34:15 +00:00
# Parse global command options.
#
# source://commander//lib/commander/runner.rb#372
2021-09-10 21:21:17 +01:00
def parse_global_options; end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/runner.rb#131
2021-09-10 21:21:17 +01:00
def program(key, *args, &block); end
2023-12-14 15:34:15 +00:00
# Returns hash of program defaults.
#
# source://commander//lib/commander/runner.rb#275
2021-09-10 21:21:17 +01:00
def program_defaults; end
2023-12-14 15:34:15 +00:00
# Removes global _options_ from _args_. This prevents an invalid
# option error from occurring when options are parsed
# again for the command.
#
# source://commander//lib/commander/runner.rb#322
2021-09-10 21:21:17 +01:00
def remove_global_options(options, args); end
2023-12-14 15:34:15 +00:00
# Raises a CommandError when the program any of the _keys_ are not present, or empty.
#
# source://commander//lib/commander/runner.rb#405
2021-09-10 21:21:17 +01:00
def require_program(*keys); end
2023-12-14 15:34:15 +00:00
# Raises InvalidCommandError when a _command_ is not found.
#
# source://commander//lib/commander/runner.rb#313
2021-09-10 21:21:17 +01:00
def require_valid_command(command = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Run command parsing and execution process.
#
# source://commander//lib/commander/runner.rb#40
2021-09-10 21:21:17 +01:00
def run!; end
2023-12-14 15:34:15 +00:00
# Run the active command.
#
# source://commander//lib/commander/runner.rb#439
2021-09-10 21:21:17 +01:00
def run_active_command; end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/runner.rb#448
2021-09-10 21:21:17 +01:00
def say(*args); end
2023-12-14 15:34:15 +00:00
# Returns array of valid command names found within _args_.
#
# source://commander//lib/commander/runner.rb#239
2021-09-10 21:21:17 +01:00
def valid_command_names_from(*args); end
2023-12-14 15:34:15 +00:00
# Return program version.
#
# source://commander//lib/commander/runner.rb#82
2021-09-10 21:21:17 +01:00
def version; end
private
2023-12-14 15:34:15 +00:00
# Attempts to locate a command name from within the provided arguments.
# Supports multi-word commands, using the largest possible match.
#
# source://commander//lib/commander/runner.rb#458
2021-09-10 21:21:17 +01:00
def longest_valid_command_name_from(args); end
class << self
2023-12-14 15:34:15 +00:00
# Return singleton Runner instance.
#
# source://commander//lib/commander/runner.rb#33
2021-09-10 21:21:17 +01:00
def instance; end
2023-12-14 15:34:15 +00:00
# Return switches and description separated from the _args_ passed.
#
# source://commander//lib/commander/runner.rb#414
2021-09-10 21:21:17 +01:00
def separate_switches_from_description(*args); end
2023-12-14 15:34:15 +00:00
# Attempts to generate a method name symbol from +switch+.
# For example:
#
# -h # => :h
# --trace # => :trace
# --some-switch # => :some_switch
# --[no-]feature # => :feature
# --file FILE # => :file
# --list of,things # => :list
#
# source://commander//lib/commander/runner.rb#432
2021-09-10 21:21:17 +01:00
def switch_to_sym(switch); end
end
end
2023-12-14 15:34:15 +00:00
# --
# Exceptions
# ++
#
# source://commander//lib/commander/runner.rb#11
2021-09-10 21:21:17 +01:00
class Commander::Runner::CommandError < ::StandardError; end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/runner.rb#13
2021-09-10 21:21:17 +01:00
class Commander::Runner::InvalidCommandError < ::Commander::Runner::CommandError; end
2023-12-14 15:34:15 +00:00
# = User Interaction
#
# Commander's user interaction module mixes in common
# methods which extend HighLine's functionality such
# as a #password method rather than calling #ask directly.
#
# source://commander//lib/commander/user_interaction.rb#14
2021-09-10 21:21:17 +01:00
module Commander::UI
private
2023-12-14 15:34:15 +00:00
# Execute apple _script_.
#
# source://commander//lib/commander/user_interaction.rb#193
2021-09-10 21:21:17 +01:00
def applescript(script); end
2023-12-14 15:34:15 +00:00
# Prompt an editor for input. Optionally supply initial
# _input_ which is written to the editor.
#
# _preferred_editor_ can be hinted.
#
# === Examples
#
# ask_editor # => prompts EDITOR with no input
# ask_editor('foo') # => prompts EDITOR with default text of 'foo'
# ask_editor('foo', 'mate -w') # => prompts TextMate with default text of 'foo'
#
# source://commander//lib/commander/user_interaction.rb#256
2021-09-10 21:21:17 +01:00
def ask_editor(input = T.unsafe(nil), preferred_editor = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Find an editor available in path. Optionally supply the _preferred_
# editor. Returns the name as a string, nil if none is available.
#
# source://commander//lib/commander/user_interaction.rb#237
2021-09-10 21:21:17 +01:00
def available_editor(preferred = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Choose from a set array of _choices_.
#
# source://commander//lib/commander/user_interaction.rb#43
2021-09-10 21:21:17 +01:00
def choose(message = T.unsafe(nil), *choices, &block); end
2023-12-14 15:34:15 +00:00
# 'Say' something using the specified color
#
# === Examples
# color 'I am blue', :blue
# color 'I am bold', :bold
# color 'White on Red', :white, :on_red
#
# === Notes
# You may use:
# * color: black blue cyan green magenta red white yellow
# * style: blink bold clear underline
# * highligh: on_<color>
#
# source://commander//lib/commander/user_interaction.rb#117
2021-09-10 21:21:17 +01:00
def color(*args); end
2023-12-14 15:34:15 +00:00
# Converse with speech recognition.
#
# Currently a "poorman's" DSL to utilize applescript and
# the MacOS speech recognition server.
#
# === Examples
#
# case converse 'What is the best food?', :cookies => 'Cookies', :unknown => 'Nothing'
# when :cookies
# speak 'o.m.g. you are awesome!'
# else
# case converse 'That is lame, shall I convince you cookies are the best?', :yes => 'Ok', :no => 'No', :maybe => 'Maybe another time'
# when :yes
# speak 'Well you see, cookies are just fantastic.'
# else
# speak 'Ok then, bye.'
# end
# end
#
# === Notes
#
# * MacOS only
#
# source://commander//lib/commander/user_interaction.rb#168
2021-09-10 21:21:17 +01:00
def converse(prompt, responses = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Enable paging of output after called.
#
# source://commander//lib/commander/user_interaction.rb#272
2021-09-10 21:21:17 +01:00
def enable_paging; end
2023-12-14 15:34:15 +00:00
# Normalize IO streams, allowing for redirection of
# +input+ and/or +output+, for example:
#
# $ foo # => read from terminal I/O
# $ foo in # => read from 'in' file, output to terminal output stream
# $ foo in out # => read from 'in' file, output to 'out' file
# $ foo < in > out # => equivalent to above (essentially)
#
# Optionally a +block+ may be supplied, in which case
# IO will be reset once the block has executed.
#
# === Examples
#
# command :foo do |c|
# c.syntax = 'foo [input] [output]'
# c.when_called do |args, options|
# # or io(args.shift, args.shift)
# io *args
# str = $stdin.gets
# puts 'input was: ' + str.inspect
# end
# end
#
# source://commander//lib/commander/user_interaction.rb#222
2021-09-10 21:21:17 +01:00
def io(input = T.unsafe(nil), output = T.unsafe(nil), &block); end
2023-12-14 15:34:15 +00:00
# 'Log' an _action_ to the terminal. This is typically used
# for verbose output regarding actions performed. For example:
#
# create path/to/file.rb
# remove path/to/old_file.rb
# remove path/to/old_file2.rb
#
# source://commander//lib/commander/user_interaction.rb#57
2021-09-10 21:21:17 +01:00
def log(action, *args); end
2023-12-14 15:34:15 +00:00
# Ask the user for a password. Specify a custom
# _message_ other than 'Password: ' or override the
# default _mask_ of '*'.
#
# source://commander//lib/commander/user_interaction.rb#34
2021-09-10 21:21:17 +01:00
def password(message = T.unsafe(nil), mask = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Output progress while iterating _arr_.
#
# === Examples
#
# uris = %w( http://vision-media.ca http://google.com )
# progress uris, :format => "Remaining: :time_remaining" do |uri|
# res = open uri
# end
#
# source://commander//lib/commander/user_interaction.rb#316
2021-09-10 21:21:17 +01:00
def progress(arr, options = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Substitute _hash_'s keys with their associated values in _str_.
#
# source://commander//lib/commander/user_interaction.rb#376
2021-09-10 21:21:17 +01:00
def replace_tokens(str, hash); end
2023-12-14 15:34:15 +00:00
# 'Say' something using the ERROR color (red).
#
# === Examples
# say_error 'Everything is not fine'
# say_error 'It is not ok', 'This is not ok too'
#
# source://commander//lib/commander/user_interaction.rb#97
2021-09-10 21:21:17 +01:00
def say_error(*args); end
2023-12-14 15:34:15 +00:00
# 'Say' something using the OK color (green).
#
# === Examples
# say_ok 'Everything is fine'
# say_ok 'It is ok', 'This is ok too'
#
# source://commander//lib/commander/user_interaction.rb#69
2021-09-10 21:21:17 +01:00
def say_ok(*args); end
2023-12-14 15:34:15 +00:00
# 'Say' something using the WARNING color (yellow).
#
# === Examples
# say_warning 'This is a warning'
# say_warning 'Be careful', 'Think about it'
#
# source://commander//lib/commander/user_interaction.rb#83
2021-09-10 21:21:17 +01:00
def say_warning(*args); end
2023-12-14 15:34:15 +00:00
# Speak _message_ using _voice_ at a speaking rate of _rate_
#
# Voice defaults to 'Alex', which is one of the better voices.
# Speaking rate defaults to 175 words per minute
#
# === Examples
#
# speak 'What is your favorite food? '
# food = ask 'favorite food?: '
# speak "Wow, I like #{food} too. We have so much in common."
# speak "I like #{food} as well!", "Victoria", 190
#
# === Notes
#
# * MacOS only
#
# source://commander//lib/commander/user_interaction.rb#139
2021-09-10 21:21:17 +01:00
def speak(message, voice = T.unsafe(nil), rate = T.unsafe(nil)); end
class << self
2023-12-14 15:34:15 +00:00
# Execute apple _script_.
#
# source://commander//lib/commander/user_interaction.rb#193
2021-09-10 21:21:17 +01:00
def applescript(script); end
2023-12-14 15:34:15 +00:00
# Prompt an editor for input. Optionally supply initial
# _input_ which is written to the editor.
#
# _preferred_editor_ can be hinted.
#
# === Examples
#
# ask_editor # => prompts EDITOR with no input
# ask_editor('foo') # => prompts EDITOR with default text of 'foo'
# ask_editor('foo', 'mate -w') # => prompts TextMate with default text of 'foo'
#
# source://commander//lib/commander/user_interaction.rb#256
2021-09-10 21:21:17 +01:00
def ask_editor(input = T.unsafe(nil), preferred_editor = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Find an editor available in path. Optionally supply the _preferred_
# editor. Returns the name as a string, nil if none is available.
#
# source://commander//lib/commander/user_interaction.rb#237
2021-09-10 21:21:17 +01:00
def available_editor(preferred = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Choose from a set array of _choices_.
#
# source://commander//lib/commander/user_interaction.rb#43
2021-09-10 21:21:17 +01:00
def choose(message = T.unsafe(nil), *choices, &block); end
2023-12-14 15:34:15 +00:00
# 'Say' something using the specified color
#
# === Examples
# color 'I am blue', :blue
# color 'I am bold', :bold
# color 'White on Red', :white, :on_red
#
# === Notes
# You may use:
# * color: black blue cyan green magenta red white yellow
# * style: blink bold clear underline
# * highligh: on_<color>
#
# source://commander//lib/commander/user_interaction.rb#117
2021-09-10 21:21:17 +01:00
def color(*args); end
2023-12-14 15:34:15 +00:00
# Converse with speech recognition.
#
# Currently a "poorman's" DSL to utilize applescript and
# the MacOS speech recognition server.
#
# === Examples
#
# case converse 'What is the best food?', :cookies => 'Cookies', :unknown => 'Nothing'
# when :cookies
# speak 'o.m.g. you are awesome!'
# else
# case converse 'That is lame, shall I convince you cookies are the best?', :yes => 'Ok', :no => 'No', :maybe => 'Maybe another time'
# when :yes
# speak 'Well you see, cookies are just fantastic.'
# else
# speak 'Ok then, bye.'
# end
# end
#
# === Notes
#
# * MacOS only
#
# source://commander//lib/commander/user_interaction.rb#168
2021-09-10 21:21:17 +01:00
def converse(prompt, responses = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Enable paging of output after called.
#
# source://commander//lib/commander/user_interaction.rb#272
2021-09-10 21:21:17 +01:00
def enable_paging; end
2023-12-14 15:34:15 +00:00
# Normalize IO streams, allowing for redirection of
# +input+ and/or +output+, for example:
#
# $ foo # => read from terminal I/O
# $ foo in # => read from 'in' file, output to terminal output stream
# $ foo in out # => read from 'in' file, output to 'out' file
# $ foo < in > out # => equivalent to above (essentially)
#
# Optionally a +block+ may be supplied, in which case
# IO will be reset once the block has executed.
#
# === Examples
#
# command :foo do |c|
# c.syntax = 'foo [input] [output]'
# c.when_called do |args, options|
# # or io(args.shift, args.shift)
# io *args
# str = $stdin.gets
# puts 'input was: ' + str.inspect
# end
# end
#
# source://commander//lib/commander/user_interaction.rb#222
2021-09-10 21:21:17 +01:00
def io(input = T.unsafe(nil), output = T.unsafe(nil), &block); end
2023-12-14 15:34:15 +00:00
# 'Log' an _action_ to the terminal. This is typically used
# for verbose output regarding actions performed. For example:
#
# create path/to/file.rb
# remove path/to/old_file.rb
# remove path/to/old_file2.rb
#
# source://commander//lib/commander/user_interaction.rb#57
2021-09-10 21:21:17 +01:00
def log(action, *args); end
2023-12-14 15:34:15 +00:00
# Ask the user for a password. Specify a custom
# _message_ other than 'Password: ' or override the
# default _mask_ of '*'.
#
# source://commander//lib/commander/user_interaction.rb#34
2021-09-10 21:21:17 +01:00
def password(message = T.unsafe(nil), mask = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Output progress while iterating _arr_.
#
# === Examples
#
# uris = %w( http://vision-media.ca http://google.com )
# progress uris, :format => "Remaining: :time_remaining" do |uri|
# res = open uri
# end
#
# source://commander//lib/commander/user_interaction.rb#316
2021-09-10 21:21:17 +01:00
def progress(arr, options = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Substitute _hash_'s keys with their associated values in _str_.
#
# source://commander//lib/commander/user_interaction.rb#376
2021-09-10 21:21:17 +01:00
def replace_tokens(str, hash); end
2023-12-14 15:34:15 +00:00
# 'Say' something using the ERROR color (red).
#
# === Examples
# say_error 'Everything is not fine'
# say_error 'It is not ok', 'This is not ok too'
#
# source://commander//lib/commander/user_interaction.rb#97
2021-09-10 21:21:17 +01:00
def say_error(*args); end
2023-12-14 15:34:15 +00:00
# 'Say' something using the OK color (green).
#
# === Examples
# say_ok 'Everything is fine'
# say_ok 'It is ok', 'This is ok too'
#
# source://commander//lib/commander/user_interaction.rb#69
2021-09-10 21:21:17 +01:00
def say_ok(*args); end
2023-12-14 15:34:15 +00:00
# 'Say' something using the WARNING color (yellow).
#
# === Examples
# say_warning 'This is a warning'
# say_warning 'Be careful', 'Think about it'
#
# source://commander//lib/commander/user_interaction.rb#83
2021-09-10 21:21:17 +01:00
def say_warning(*args); end
2023-12-14 15:34:15 +00:00
# Speak _message_ using _voice_ at a speaking rate of _rate_
#
# Voice defaults to 'Alex', which is one of the better voices.
# Speaking rate defaults to 175 words per minute
#
# === Examples
#
# speak 'What is your favorite food? '
# food = ask 'favorite food?: '
# speak "Wow, I like #{food} too. We have so much in common."
# speak "I like #{food} as well!", "Victoria", 190
#
# === Notes
#
# * MacOS only
#
# source://commander//lib/commander/user_interaction.rb#139
2021-09-10 21:21:17 +01:00
def speak(message, voice = T.unsafe(nil), rate = T.unsafe(nil)); end
end
end
2023-12-14 15:34:15 +00:00
# Implements ask_for_CLASS methods.
#
# source://commander//lib/commander/user_interaction.rb#325
2021-09-10 21:21:17 +01:00
module Commander::UI::AskForClass
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/user_interaction.rb#330
2021-09-10 21:21:17 +01:00
def ask_for_array(prompt); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/user_interaction.rb#330
2021-09-10 21:21:17 +01:00
def ask_for_file(prompt); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/user_interaction.rb#330
2021-09-10 21:21:17 +01:00
def ask_for_float(prompt); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/user_interaction.rb#330
2021-09-10 21:21:17 +01:00
def ask_for_integer(prompt); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/user_interaction.rb#330
2021-09-10 21:21:17 +01:00
def ask_for_pathname(prompt); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/user_interaction.rb#330
2021-09-10 21:21:17 +01:00
def ask_for_regexp(prompt); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/user_interaction.rb#330
2021-09-10 21:21:17 +01:00
def ask_for_string(prompt); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/user_interaction.rb#330
2021-09-10 21:21:17 +01:00
def ask_for_symbol(prompt); end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/user_interaction.rb#335
2021-09-10 21:21:17 +01:00
def method_missing(method_name, *arguments, &block); end
private
2023-12-14 15:34:15 +00:00
# @return [Boolean]
#
# source://commander//lib/commander/user_interaction.rb#368
2021-09-10 21:21:17 +01:00
def respond_to_missing?(method_name, include_private = T.unsafe(nil)); end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/user_interaction.rb#326
2021-09-10 21:21:17 +01:00
Commander::UI::AskForClass::DEPRECATED_CONSTANTS = T.let(T.unsafe(nil), Array)
2023-12-14 15:34:15 +00:00
# = Progress Bar
#
# Terminal progress bar utility. In its most basic form
# requires that the developer specifies when the bar should
# be incremented. Note that a hash of tokens may be passed to
# #increment, (or returned when using Object#progress).
#
# uris = %w(
# http://vision-media.ca
# http://yahoo.com
# http://google.com
# )
#
# bar = Commander::UI::ProgressBar.new uris.length, options
# threads = []
# uris.each do |uri|
# threads << Thread.new do
# begin
# res = open uri
# bar.increment :uri => uri
# rescue Exception => e
# bar.increment :uri => "#{uri} failed"
# end
# end
# end
# threads.each { |t| t.join }
#
# The Object method #progress is also available:
#
# progress uris, :width => 10 do |uri|
# res = open uri
# { :uri => uri } # Can now use :uri within :format option
# end
#
# source://commander//lib/commander/user_interaction.rb#418
2021-09-10 21:21:17 +01:00
class Commander::UI::ProgressBar
2023-12-14 15:34:15 +00:00
# Creates a new progress bar.
#
# === Options
#
# :title Title, defaults to "Progress"
# :width Width of :progress_bar
# :progress_str Progress string, defaults to "="
# :incomplete_str Incomplete bar string, defaults to '.'
# :format Defaults to ":title |:progress_bar| :percent_complete% complete "
# :tokens Additional tokens replaced within the format string
# :complete_message Defaults to "Process complete"
#
# === Tokens
#
# :title
# :percent_complete
# :progress_bar
# :step
# :steps_remaining
# :total_steps
# :time_elapsed
# :time_remaining
#
# @return [ProgressBar] a new instance of ProgressBar
#
# source://commander//lib/commander/user_interaction.rb#444
2021-09-10 21:21:17 +01:00
def initialize(total, options = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Whether or not the operation has completed.
#
# @return [Boolean]
#
# source://commander//lib/commander/user_interaction.rb#534
2021-09-10 21:21:17 +01:00
def completed?; end
2023-12-14 15:34:15 +00:00
# Erase previous terminal line.
#
# source://commander//lib/commander/user_interaction.rb#551
2021-09-10 21:21:17 +01:00
def erase_line; end
2023-12-14 15:34:15 +00:00
# Whether or not the operation is complete, and we have finished.
#
# @return [Boolean]
#
# source://commander//lib/commander/user_interaction.rb#527
2021-09-10 21:21:17 +01:00
def finished?; end
2023-12-14 15:34:15 +00:00
# Generates tokens for this step.
#
# source://commander//lib/commander/user_interaction.rb#497
2021-09-10 21:21:17 +01:00
def generate_tokens; end
2023-12-14 15:34:15 +00:00
# Increment progress. Optionally pass _tokens_ which
# can be displayed in the output format.
#
# source://commander//lib/commander/user_interaction.rb#542
2021-09-10 21:21:17 +01:00
def increment(tokens = T.unsafe(nil)); end
2023-12-14 15:34:15 +00:00
# Completion percentage.
#
# source://commander//lib/commander/user_interaction.rb#458
2021-09-10 21:21:17 +01:00
def percent_complete; end
2023-12-14 15:34:15 +00:00
# Formatted progress bar.
#
# source://commander//lib/commander/user_interaction.rb#490
2021-09-10 21:21:17 +01:00
def progress_bar; end
2023-12-14 15:34:15 +00:00
# Output the progress bar.
#
# source://commander//lib/commander/user_interaction.rb#513
2021-09-10 21:21:17 +01:00
def show; end
2023-12-14 15:34:15 +00:00
# Number of steps left.
#
# source://commander//lib/commander/user_interaction.rb#483
2021-09-10 21:21:17 +01:00
def steps_remaining; end
2023-12-14 15:34:15 +00:00
# Time that has elapsed since the operation started.
#
# source://commander//lib/commander/user_interaction.rb#469
2021-09-10 21:21:17 +01:00
def time_elapsed; end
2023-12-14 15:34:15 +00:00
# Estimated time remaining.
#
# source://commander//lib/commander/user_interaction.rb#476
2021-09-10 21:21:17 +01:00
def time_remaining; end
end
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/version.rb#4
2021-09-10 21:21:17 +01:00
Commander::VERSION = T.let(T.unsafe(nil), String)
2023-12-14 15:34:15 +00:00
# source://commander//lib/commander/core_ext/object.rb#3
2021-09-10 21:21:17 +01:00
class Object < ::BasicObject
include ::Kernel
include ::PP::ObjectMixin
2023-12-14 15:34:15 +00:00
# Return the current binding.
#
# source://commander//lib/commander/core_ext/object.rb#7
2021-09-10 21:21:17 +01:00
def get_binding; end
end