davetron5000 / gli

Make awesome command-line applications the easy way
http://davetron5000.github.io/gli
Apache License 2.0
1.26k stars 102 forks source link

Explicit support for documenting examples #261

Closed davetron5000 closed 7 years ago

davetron5000 commented 7 years ago

For complex command-line apps, it's nice to be able to show some example invocations to help users know what things mean. While these could be dumped into long_desc, it's nicer to make them explicit.

This works like so:


command :list do |c|
  c.example "todo list", desc: "List all tasks"
  c.example "todo list --wip", desc: "List all tasks in progress"
end

And gets output like:

EXAMPLES

    # List all tasks
    todo list

    # List all tasks in progress
    todo list --wip
davetron5000 commented 7 years ago

JRuby can't find JSON which is only needed for the docs. Worked before, probably will work again.