Emacs: Fix style in shell skeletons
parent
afa1e1cb94
commit
c0d4fb0488
|
@ -68,16 +68,14 @@ The advantages of this function over the vanilla code are:
|
||||||
(define-skeleton sh-check
|
(define-skeleton sh-check
|
||||||
"Insert a function checking for presence in PATH."
|
"Insert a function checking for presence in PATH."
|
||||||
nil
|
nil
|
||||||
"check()
|
"check() {" \n
|
||||||
{
|
"for i ; do" \n
|
||||||
for i ; do
|
"if ! command -v $i >/dev/null 2>&1; then" \n
|
||||||
if ! command -v $i >/dev/null 2>&1; then
|
"echo \"'$i' not found in PATH. Exiting.\" >&2" \n
|
||||||
echo \"'$i' not found in PATH. Exiting.\" >&2
|
"exit 1" \n
|
||||||
exit 1
|
"fi" \n
|
||||||
fi
|
"done" \n
|
||||||
done
|
"}" > \n)
|
||||||
}
|
|
||||||
")
|
|
||||||
|
|
||||||
(define-skeleton sh-command
|
(define-skeleton sh-command
|
||||||
"Insert a line that executes if command is found in path."
|
"Insert a line that executes if command is found in path."
|
||||||
|
@ -118,10 +116,9 @@ The advantages of this function over the vanilla code are:
|
||||||
(define-skeleton sh-while-getopts
|
(define-skeleton sh-while-getopts
|
||||||
"Insert a getops prototype."
|
"Insert a getops prototype."
|
||||||
"optstring: "
|
"optstring: "
|
||||||
> "usage ()
|
> "usage() {" \n
|
||||||
{
|
"cat<<EOF" > \n ; TODO: Why is '>' necessary here?
|
||||||
cat<<EOF
|
"Usage: ${1##*/} [OPTIONS] FILES
|
||||||
Usage: ${1##*/} [OPTIONS] FILES
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
|
@ -147,10 +144,10 @@ EOF
|
||||||
"esac" > \n
|
"esac" > \n
|
||||||
"done" > \n \n
|
"done" > \n \n
|
||||||
"shift $(($OPTIND - 1))" \n
|
"shift $(($OPTIND - 1))" \n
|
||||||
"if [ $# -eq 0 ]; then
|
"if [ $# -eq 0 ]; then" \n
|
||||||
usage \"$0\"
|
"usage \"$0\"" > \n ; TODO: Why is '>' necessary here?
|
||||||
exit 1
|
"exit 1" \n
|
||||||
fi" \n)
|
"fi" > \n)
|
||||||
|
|
||||||
(define-skeleton sh-while-read
|
(define-skeleton sh-while-read
|
||||||
"Insert a while read loop."
|
"Insert a while read loop."
|
||||||
|
|
Loading…
Reference in New Issue