Class: CLAideCompletion::Generator::Zsh
- Inherits:
-
Object
- Object
- CLAideCompletion::Generator::Zsh
- Defined in:
- lib/claide_completion/generator/zsh.rb
Overview
Generates a completion script for the Z shell.
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
-
#generate ⇒ String
The completion script.
-
#initialize(command) ⇒ Zsh
constructor
A new instance of Zsh.
Constructor Details
#initialize(command) ⇒ Zsh
Returns a new instance of Zsh.
11 12 13 |
# File 'lib/claide_completion/generator/zsh.rb', line 11 def initialize(command) @command = command end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
6 7 8 |
# File 'lib/claide_completion/generator/zsh.rb', line 6 def command @command end |
Instance Method Details
#generate ⇒ String
Returns The completion script.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/claide_completion/generator/zsh.rb', line 17 def generate result = "#compdef \#{command.command}\n# setopt XTRACE VERBOSE\n# vim: ft=zsh sw=2 ts=2 et\n\nlocal -a _subcommands\nlocal -a _options\n\n\#{case_statement_fragment(command)}\n" post_process(result) end |