Class: Pikuri::Command::Registry::Command

Inherits:
Data
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#argument_hintString? (readonly)

Returns opaque display string, e.g. "<label> [--since DATE]".

Returns:

  • (String, nil)

    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

#bodyString (readonly)

Returns everything after the frontmatter, un-expanded.

Returns:

  • (String)

    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

#descriptionString (readonly)

Returns menu chrome; the name itself when the file gave none.

Returns:

  • (String)

    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

#locationString (readonly)

Returns absolute path of the .md.

Returns:

  • (String)

    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

#nameString (readonly)

Returns the address the human types, / excluded.

Returns:

  • (String)

    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

#refusalString? (readonly)

Returns why this cannot run, captured at scan time so Pikuri::Command::Registry#get re-reads nothing; nil when it can.

Returns:



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

#sidecarsBoolean (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.

Returns:

  • (Boolean)

    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.

Returns:



107
# File 'lib/pikuri/command/registry.rb', line 107

def refused? = !refusal.nil?

#sidecars?Boolean

Returns:

  • (Boolean)


110
# File 'lib/pikuri/command/registry.rb', line 110

def sidecars? = sidecars