Compare commits
2 Commits
5d69916682
...
6366167443
Author | SHA1 | Date |
---|---|---|
BodgeMaster | 6366167443 | |
BodgeMaster | b80eb821c8 |
|
@ -248,7 +248,7 @@ void getAndRunCommand(){
|
||||||
" lock the Arduino's state by running an infinite loop\n\r"
|
" lock the Arduino's state by running an infinite loop\n\r"
|
||||||
" L loop\n\r"
|
" L loop\n\r"
|
||||||
" usage: followed by a 5 digit uint16_t number,\n\r"
|
" usage: followed by a 5 digit uint16_t number,\n\r"
|
||||||
" then one of the lowercas commands with arguments\n\r"
|
" then one of the lowercase commands with arguments\n\r"
|
||||||
" repeat the command given as an argument\n\r"
|
" repeat the command given as an argument\n\r"
|
||||||
" m set mode\n\r"
|
" m set mode\n\r"
|
||||||
" usage: followed by two digit pin number and o or i\n\r"
|
" usage: followed by two digit pin number and o or i\n\r"
|
||||||
|
@ -273,7 +273,8 @@ void getAndRunCommand(){
|
||||||
" sets pullup resistor for input pins\n\r"
|
" sets pullup resistor for input pins\n\r"
|
||||||
" \"digitalWrite\"\n\r"
|
" \"digitalWrite\"\n\r"
|
||||||
" p write pwm\n\r"
|
" p write pwm\n\r"
|
||||||
" usage: followed by two digit pin number and three digit value between 000 and 255\n\r"
|
" usage: followed by two digit pin number and three digit value\n\r"
|
||||||
|
" between 000 and 255\n\r"
|
||||||
" \"analogWrite\"\n\r"
|
" \"analogWrite\"\n\r"
|
||||||
" t toggle pin state\n\r"
|
" t toggle pin state\n\r"
|
||||||
" usage: followed by two digit pin number\n\r"
|
" usage: followed by two digit pin number\n\r"
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/sh
|
||||||
|
internal_path="$(echo $PATH | sed -e 's/:/\n/g')"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
if getopts "ac:h" arg; then
|
||||||
|
true # do nothing
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
case $arg in
|
||||||
|
a)
|
||||||
|
all="yes"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
internal_path="$(echo $OPTARG | sed -e 's/:/\n/g')"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
h)
|
||||||
|
echo "Usage: $0 [-a] [-c <custom path>] <command>"
|
||||||
|
echo \
|
||||||
|
'Options:
|
||||||
|
-a return all results if multiple found
|
||||||
|
-c <custom path> search in the specified path instead of $PATH
|
||||||
|
-h display this message'
|
||||||
|
echo \
|
||||||
|
"Exit codes:
|
||||||
|
0 found
|
||||||
|
1 not found
|
||||||
|
2 error"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
echo "Usage: $0 [-a] [-c <custom path>] <command>"
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
IFS='
|
||||||
|
'
|
||||||
|
for directory in $internal_path; do
|
||||||
|
if [ -e "$directory/$1" ]; then
|
||||||
|
echo "$directory/$1"
|
||||||
|
if [ "$all" = "yes" ]; then
|
||||||
|
found="yes"
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$found" = "yes" ]; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue