2016-12-15 20:07:43 -05:00
|
|
|
#!/bin/bash -e
|
2016-05-22 23:11:26 -07:00
|
|
|
|
2016-12-15 20:07:43 -05:00
|
|
|
is_not_a_valid() {
|
|
|
|
local target=$1
|
|
|
|
[ ! -x "$target" ] || [ ! -f "$target" ]
|
|
|
|
}
|
2016-05-22 23:11:26 -07:00
|
|
|
|
2016-12-15 20:07:43 -05:00
|
|
|
get_help_statement_for() {
|
|
|
|
local target=$1
|
|
|
|
grep '^# help:' $target | sed 's/# help://'
|
|
|
|
}
|
2016-05-22 23:11:26 -07:00
|
|
|
|
2016-12-15 20:07:43 -05:00
|
|
|
cd $(dirname $0)
|
|
|
|
echo "Targets:"
|
2016-05-22 23:11:26 -07:00
|
|
|
|
2016-12-15 20:07:43 -05:00
|
|
|
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
|
2016-05-22 23:11:26 -07:00
|
|
|
done
|
2016-12-15 20:07:43 -05:00
|
|
|
|