kickstart/lib/kickstart-doc

18 lines
332 B
Plaintext
Raw Permalink Normal View History

2014-02-21 22:30:18 +00:00
#!/bin/bash
list() {
2015-05-20 20:16:16 +00:00
root_dir=$(kickstart root-dir)
length_of_path=$(wc -m <<<"$root_dir/docs/" | xargs)
find "$root_dir"/docs -type f | sed -e 's/.md$//' | cut -c "$length_of_path-" | tr '/' '.'
2014-02-21 22:30:18 +00:00
}
show() {
2015-05-20 20:16:16 +00:00
cat "$(kickstart root-dir)"/docs/"$(echo "$1" | tr '.' '/')".md
2014-02-21 22:30:18 +00:00
}
2015-05-20 20:16:16 +00:00
if [ -z "$1" ]; then
list
else
show "$1"
fi