Skip to content

Instantly share code, notes, and snippets.

@daniel-thompson
Last active February 3, 2017 09:47
Show Gist options
  • Save daniel-thompson/e15e2eb8d121c927db78ad48b9c7d16f to your computer and use it in GitHub Desktop.
Save daniel-thompson/e15e2eb8d121c927db78ad48b9c7d16f to your computer and use it in GitHub Desktop.
wychelm$ mkdir -p Documents/Wiki
wychelm$ cat > Documents/Wiki/Demo.md <<EOF
# Markdown title
## This sub-title will appear in kb help
If you want to really document what the fragment does I put it here including
any hyperlinks, etc, to remind me everything I need to know.
The fragment will execute with tracing (-x) and halt-on-first-error (- e)
shell options. This keeps fragments safe (they don't rumble on if they
start to go wrong) and short (no error handling needed).
~~~ sh say-hello
echo "Hello world"
~~~
EOF
wychelm$ kb help Demo
USAGE: kb ACTION Demo [ARGS...]
Run an action from the knowledge base.
Built-in actions:
dryrun Show that commands that would be expected by 'run'
edit Edit a knowledge base entry
grep Search the knowledge base
help Show this help text and, if ARGS, list available actions
html Convert the knowledge base entry to HTML
run Run an action from the knowledge base
show Show a knowledge base entry
Actions specific to Demo (from demo.md):
say-hello This sub-title will appear in kb help
wychelm$ kb say-hello Demo
+ echo 'Hello world'
Hello world
wychelm$ kb say-hello demo
+ echo 'Hello world'
Hello world
wychelm$ kb say-hello de
Misc.md has no say-hello action. Try 'kb misc help'.
Too much knowledge found for de
demo.md
debug_ll.md
debootstrap.md
devres_docs.md
wychelm$ kb say-hello dem
+ echo 'Hello world'
Hello world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment