kickstart/lib/kickstart-doc

18 lines
332 B
Bash
Executable File

#!/bin/bash
list() {
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 '/' '.'
}
show() {
cat "$(kickstart root-dir)"/docs/"$(echo "$1" | tr '.' '/')".md
}
if [ -z "$1" ]; then
list
else
show "$1"
fi