Class: CliMarkdown::Index
- Inherits:
-
Object
- Object
- CliMarkdown::Index
- Defined in:
- lib/cli_markdown/index.rb
Instance Method Summary collapse
- #command_list ⇒ Object
- #doc ⇒ Object
-
#initialize(cli_class, cli_name) ⇒ Index
constructor
A new instance of Index.
- #path ⇒ Object
Constructor Details
#initialize(cli_class, cli_name) ⇒ Index
Returns a new instance of Index.
3 4 5 6 |
# File 'lib/cli_markdown/index.rb', line 3 def initialize(cli_class, cli_name) @cli_class = cli_class @cli_name = cli_name end |
Instance Method Details
#command_list ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cli_markdown/index.rb', line 12 def command_list commands = @cli_class.commands.reject { |command_name, command| command.hidden? } commands.keys.sort.map.each do |command_name| page = Page.new( cli_class: @cli_class, cli_name: @cli_name, command_name: command_name, ) link = page.path.sub("docs/", "") # Example: [lono cfn]({% link _reference/lono-cfn.md %}) "* [#{@cli_name} #{command_name}]({% link #{link} %})" end.join("\n") end |
#doc ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cli_markdown/index.rb', line 26 def doc <<-EOL --- title: CLI Reference --- {% include reference.md %} #{command_list} EOL end |
#path ⇒ Object
8 9 10 |
# File 'lib/cli_markdown/index.rb', line 8 def path "docs/reference.md" end |