Class: Pikuri::Command::Registry::Command
- Inherits:
-
Data
- Object
- Data
- Pikuri::Command::Registry::Command
- Defined in:
- lib/pikuri/command/registry.rb
Overview
A loaded command. Bodies are eager-loaded at scan time; command files are small and expansion stays IO-free.
Instance Attribute Summary collapse
-
#argument_hint ⇒ String?
readonly
Opaque display string, e.g.
-
#body ⇒ String
readonly
Everything after the frontmatter, un-expanded.
-
#description ⇒ String
readonly
Menu chrome; the name itself when the file gave none.
-
#location ⇒ String
readonly
Absolute path of the
.md. -
#name ⇒ String
readonly
The address the human types,
/excluded. -
#refusal ⇒ String?
readonly
Why this cannot run, captured at scan time so #get re-reads nothing;
nilwhen it can. -
#sidecars ⇒ Boolean
readonly
The command's directory holds something the registry did not load as a command — a non-Markdown file, or a subdirectory holding none — which is what earns the expansion its "this command lives in …" footer.
Instance Method Summary collapse
-
#refused? ⇒ Boolean
True when #get would raise instead of returning this.
- #sidecars? ⇒ Boolean
Instance Attribute Details
#argument_hint ⇒ String? (readonly)
Returns opaque display string, e.g. "<label> [--since DATE]".
105 106 107 108 109 110 111 |
# File 'lib/pikuri/command/registry.rb', line 105 Command = Data.define(:name, :description, :argument_hint, :location, :body, :refusal, :sidecars) do # @return [Boolean] true when {#get} would raise instead of returning this def refused? = !refusal.nil? # @return [Boolean] def sidecars? = sidecars end |
#body ⇒ String (readonly)
Returns everything after the frontmatter, un-expanded.
105 106 107 108 109 110 111 |
# File 'lib/pikuri/command/registry.rb', line 105 Command = Data.define(:name, :description, :argument_hint, :location, :body, :refusal, :sidecars) do # @return [Boolean] true when {#get} would raise instead of returning this def refused? = !refusal.nil? # @return [Boolean] def sidecars? = sidecars end |
#description ⇒ String (readonly)
Returns menu chrome; the name itself when the file gave none.
105 106 107 108 109 110 111 |
# File 'lib/pikuri/command/registry.rb', line 105 Command = Data.define(:name, :description, :argument_hint, :location, :body, :refusal, :sidecars) do # @return [Boolean] true when {#get} would raise instead of returning this def refused? = !refusal.nil? # @return [Boolean] def sidecars? = sidecars end |
#location ⇒ String (readonly)
Returns absolute path of the .md.
105 106 107 108 109 110 111 |
# File 'lib/pikuri/command/registry.rb', line 105 Command = Data.define(:name, :description, :argument_hint, :location, :body, :refusal, :sidecars) do # @return [Boolean] true when {#get} would raise instead of returning this def refused? = !refusal.nil? # @return [Boolean] def sidecars? = sidecars end |
#name ⇒ String (readonly)
Returns the address the human types, / excluded.
105 106 107 108 109 110 111 |
# File 'lib/pikuri/command/registry.rb', line 105 Command = Data.define(:name, :description, :argument_hint, :location, :body, :refusal, :sidecars) do # @return [Boolean] true when {#get} would raise instead of returning this def refused? = !refusal.nil? # @return [Boolean] def sidecars? = sidecars end |
#refusal ⇒ String? (readonly)
Returns why this cannot run, captured at scan time so
Pikuri::Command::Registry#get re-reads nothing; nil when it can.
105 106 107 108 109 110 111 |
# File 'lib/pikuri/command/registry.rb', line 105 Command = Data.define(:name, :description, :argument_hint, :location, :body, :refusal, :sidecars) do # @return [Boolean] true when {#get} would raise instead of returning this def refused? = !refusal.nil? # @return [Boolean] def sidecars? = sidecars end |
#sidecars ⇒ Boolean (readonly)
Returns the command's directory holds something the registry did not load as a command — a non-Markdown file, or a subdirectory holding none — which is what earns the expansion its "this command lives in …" footer.
105 106 107 108 109 110 111 |
# File 'lib/pikuri/command/registry.rb', line 105 Command = Data.define(:name, :description, :argument_hint, :location, :body, :refusal, :sidecars) do # @return [Boolean] true when {#get} would raise instead of returning this def refused? = !refusal.nil? # @return [Boolean] def sidecars? = sidecars end |
Instance Method Details
#refused? ⇒ Boolean
Returns true when Pikuri::Command::Registry#get would raise instead of returning this.
107 |
# File 'lib/pikuri/command/registry.rb', line 107 def refused? = !refusal.nil? |
#sidecars? ⇒ Boolean
110 |
# File 'lib/pikuri/command/registry.rb', line 110 def sidecars? = sidecars |