Class: Locallingo::CLI
- Inherits:
-
Object
- Object
- Locallingo::CLI
- Defined in:
- lib/locallingo/cli.rb
Overview
The lingo command-line interface.
Canonical form is subcommands (lingo translate, lingo validate, ...).
The legacy flag form (lingo --translate) still works but prints a
deprecation notice, so callers can migrate incrementally.
Constant Summary collapse
- CLI_NAME =
"lingo"- COMMANDS =
subcommand => the legacy flag it replaces
{ "status" => "--status", "translate" => "--translate", "validate" => "--validate", "quality" => "--check-quality", "fix-quality" => "--fix-quality", "accept-edits" => "--accept-edits", "hash" => "--hash", "sync" => "--sync-state" }.freeze
- LEGACY_FLAGS =
legacy flag => subcommand (for the deprecation path)
{ "--status" => "status", "--translate" => "translate", "--validate" => "validate", "--check-quality" => "quality", "--fix-quality" => "fix-quality", "--accept-edits" => "accept-edits", "--hash" => "hash", "--sync-state" => "sync" }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
47 48 49 50 |
# File 'lib/locallingo/cli.rb', line 47 def initialize(argv) @argv = argv.dup @options = { format: :text } end |
Class Method Details
.start(argv = ARGV) ⇒ Object
43 44 45 |
# File 'lib/locallingo/cli.rb', line 43 def self.start(argv = ARGV) new(argv).run end |
Instance Method Details
#run ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/locallingo/cli.rb', line 52 def run command = resolve_command = config = Locallingo.configuration(root_path: Dir.pwd, package: [:package]) dispatch(command, config, ) rescue Locallingo::Error => e warn "❌ #{e.}" exit 1 end |