Class: OKF::CLI::Pro
- Inherits:
-
Command
- Object
- Command
- OKF::CLI::Pro
- Defined in:
- lib/okf/plugin.rb
Overview
okf pro — this gem's entry point, and its only one.
Class Method Summary collapse
-
.help_rows ⇒ Object
ONE row, and the first row is the summary.
- .id ⇒ Object
Instance Method Summary collapse
-
#call(argv) ⇒ Object
The whole public surface, and the whole of the Ruby-side guard.
Class Method Details
.help_rows ⇒ Object
ONE row, and the first row is the summary.
okf help prints a map, not a manual: it says a verb exists and who
ships it, and okf pro --help is where this verb describes itself.
Eight rows here made the extensions block the longest section of that
map — longer than every built-in group — for a gem the reader may not
even have been looking for. The kernel now takes only the first row from
an extension, so declaring more would not print them; declaring one is
this side of the same decision, and keeps help_rows from claiming a
surface the map does not show.
65 66 67 |
# File 'lib/okf/plugin.rb', line 65 def self.help_rows [ [ "pro <command> [DIR]", "scaffold an agent's knowledge repo, and enforce it at three doors" ] ] end |
.id ⇒ Object
51 52 53 |
# File 'lib/okf/plugin.rb', line 51 def self.id :pro end |
Instance Method Details
#call(argv) ⇒ Object
The whole public surface, and the whole of the Ruby-side guard.
rescue Exception is the cop's textbook mistake everywhere else in this
repo, and it is the correct call exactly here: the failures this must
catch are ScriptErrors, which are not StandardErrors, and catching less
than Exception is the same as catching nothing. SystemExit is re-raised
rather than swallowed — okf/pro.rb refuses an under-floor Ruby with
exit 2, and a rescue that turned that refusal into an error report
would be the fail-open this method exists to close.
rubocop:disable Lint/RescueException
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/okf/plugin.rb', line 80 def call(argv) verb = argv.first.to_s return refuse_unknown_check(argv) if verb == "hook" && !hook_check?(argv[1]) require "okf/pro" status = ::OKF::Pro::CLI.run(argv.dup.tap { |a| a.shift if verb == "hook" }, stdin: input, stdout: @out, stderr: @err) # A non-Integer status is not a verdict, and `exit` would read it as one: # `exit(true)` is 0, `exit(nil)` is 1, and both are a gate saying nothing # while the protocol hears "fine". status.is_a?(Integer) ? status : blocked("returned #{status.inspect} instead of an exit status") rescue ::SystemExit raise rescue ::Exception => e blocked("#{e.class}: #{e.}") end |