Class: I18nFlow::CLI
- Inherits:
-
Object
- Object
- I18nFlow::CLI
- Defined in:
- lib/i18n_flow/cli.rb,
lib/i18n_flow/cli/color.rb,
lib/i18n_flow/cli/command_base.rb,
lib/i18n_flow/cli/copy_command.rb,
lib/i18n_flow/cli/help_command.rb,
lib/i18n_flow/cli/lint_command.rb,
lib/i18n_flow/cli/split_command.rb,
lib/i18n_flow/cli/format_command.rb,
lib/i18n_flow/cli/search_command.rb,
lib/i18n_flow/cli/version_command.rb,
lib/i18n_flow/cli/read_config_command.rb
Defined Under Namespace
Modules: Color Classes: CommandBase, CopyCommand, FormatCommand, HelpCommand, LintCommand, ReadConfigCommand, SearchCommand, SplitCommand, VersionCommand
Constant Summary collapse
- COMMANDS =
{ 'copy' => CopyCommand, 'format' => FormatCommand, 'help' => HelpCommand, 'lint' => LintCommand, 'read_config' => ReadConfigCommand, 'search' => SearchCommand, 'split' => SplitCommand, 'version' => VersionCommand, }
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#global_options ⇒ Object
readonly
Returns the value of attribute global_options.
Instance Method Summary collapse
-
#initialize(args) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ CLI
Returns a new instance of CLI.
28 29 30 31 |
# File 'lib/i18n_flow/cli.rb', line 28 def initialize(args) = I18nFlow::Util.(args) @command, *@args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
24 25 26 |
# File 'lib/i18n_flow/cli.rb', line 24 def args @args end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
25 26 27 |
# File 'lib/i18n_flow/cli.rb', line 25 def command @command end |
#global_options ⇒ Object (readonly)
Returns the value of attribute global_options.
26 27 28 |
# File 'lib/i18n_flow/cli.rb', line 26 def end |
Instance Method Details
#run ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/i18n_flow/cli.rb', line 33 def run if ['v'] || ['version'] @command = 'version' end if ['h'] @command = 'help' end command_class = COMMANDS[command] || COMMANDS['help'] command_class.new(args).invoke! end |