1
0
mirror of https://github.com/rancher/os.git synced 2025-04-28 11:24:26 +00:00
os/scripts/help
Philippe Godin 0cdfbc76b5 Refactored make help target
Fixes issue #1450
2016-12-15 20:07:43 -05:00

24 lines
434 B
Bash
Executable File

#!/bin/bash -e
is_not_a_valid() {
local target=$1
[ ! -x "$target" ] || [ ! -f "$target" ]
}
get_help_statement_for() {
local target=$1
grep '^# help:' $target | sed 's/# help://'
}
cd $(dirname $0)
echo "Targets:"
for target in *; do
is_not_a_valid $target && continue
help_statement=$(get_help_statement_for $target)
if [ -n "$help_statement" ]; then
echo -e " $target: $help_statement"
fi
done