mirror of
https://github.com/rancher/os.git
synced 2025-06-20 04:01:55 +00:00
parent
05b8587849
commit
0cdfbc76b5
32
scripts/help
32
scripts/help
@ -1,17 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash -e
|
||||||
set -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)
|
cd $(dirname $0)
|
||||||
|
echo "Targets:"
|
||||||
|
|
||||||
echo Targets:
|
for target in *; do
|
||||||
|
is_not_a_valid $target && continue
|
||||||
for i in *; do
|
help_statement=$(get_help_statement_for $target)
|
||||||
if [ ! -x $i ] || [ ! -f $i ]; then
|
if [ -n "$help_statement" ]; then
|
||||||
continue
|
echo -e " $target: $help_statement"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MSG=$(grep '^# help:' $i)
|
|
||||||
if [ -n "$MSG" ]; then
|
|
||||||
echo " " ${i}: $(echo $MSG | sed 's/# help://')
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user