Class: Mammoth::CLI
- Inherits:
-
Object
- Object
- Mammoth::CLI
- Defined in:
- lib/mammoth/cli.rb
Overview
Small command dispatcher for Mammoth's operator-facing CLI.
Defined Under Namespace
Classes: DEAD_LETTER_TRANSACTION_ENVELOPE
Constant Summary collapse
- USAGE =
Human-readable command usage printed for invalid or incomplete invocations.
[ "Usage:", " mammoth version", " mammoth validate CONFIG", " mammoth bootstrap CONFIG", " mammoth status CONFIG", " mammoth start CONFIG", " mammoth deliver-sample CONFIG EVENT_JSON", " mammoth dead-letters list CONFIG [--status STATUS] [--destination NAME] " \ "[--failed-after ISO8601] [--failed-before ISO8601] [--limit N]", " mammoth dead-letters show CONFIG ID", " mammoth dead-letters replay CONFIG [ID ...] [--destination NAME] [--status STATUS] " \ "[--failed-after ISO8601] [--failed-before ISO8601] [--limit N]", " mammoth observability CONFIG" ].join("\n")
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
Class Method Summary collapse
-
.call(argv) ⇒ Integer
Run the CLI.
Instance Method Summary collapse
-
#call ⇒ Integer
Dispatch the requested command.
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
46 47 48 |
# File 'lib/mammoth/cli.rb', line 46 def initialize(argv) @argv = argv end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
43 44 45 |
# File 'lib/mammoth/cli.rb', line 43 def argv @argv end |
Class Method Details
.call(argv) ⇒ Integer
Run the CLI.
39 40 41 |
# File 'lib/mammoth/cli.rb', line 39 def self.call(argv) new(argv).call end |
Instance Method Details
#call ⇒ Integer
Dispatch the requested command.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/mammoth/cli.rb', line 53 def call case command when "version" then version when "validate" then validate when "bootstrap" then bootstrap when "status" then status when "start" then start when "deliver-sample" then deliver_sample when "dead-letters" then dead_letters when "observability" then observability else warn USAGE 1 end rescue Mammoth::Error => e warn e. 1 end |