From: Tomek Mrugalski Date: Thu, 8 Aug 2019 14:45:17 +0000 (+0200) Subject: [#201] Migrated script to /bin/sh, addresses shellcheck problems X-Git-Tag: Kea-1.7.0~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2F201-migrate-script-to-bin-sh;p=thirdparty%2Fkea.git [#201] Migrated script to /bin/sh, addresses shellcheck problems --- diff --git a/doc/sphinx/api/generate-templates b/doc/sphinx/api/generate-templates index 762bc1a687..ac1f0d6a58 100755 --- a/doc/sphinx/api/generate-templates +++ b/doc/sphinx/api/generate-templates @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # This script generates API documentation templates. # Usage: @@ -8,7 +8,7 @@ # File is expected to have a list of commands, one per line. # The templates will be created in api/ directory. -if (( $# != 1 )); then +if [ $# != 1 ]; then echo "Usage: ./generate-templates file" echo echo "File specifies a plain text file with each line having name of a command" @@ -21,24 +21,25 @@ mkdir -p api/ while read -r CMD; do F=api/$CMD.json - if [ -e $F ]; then + if [ -e "$F" ]; then echo "$F exists, skipping" continue; fi - echo "{" > $F - echo " \"name\": \"$CMD\"," >> $F - echo " \"brief\": \"a sentence or two explaining what this command does\"," >> $F - echo " \"description\": \"See \"," >> $F - echo " \"support\": [ \"undocumented\" ]," >> $F - echo " \"avail\": \"0.0.0\"," >> $F - echo " \"hook\": \"undocumented\"," >> $F + echo "{" > "$F" - echo " \"cmd-syntax\": \"Syntax of the command\"," >> $F - echo " \"cmd-comment\": \"Possibly some extra comments after the syntax.\"," >> $F + echo " \"name\": \"$CMD\"," >> "$F" + echo " \"brief\": [ \"a sentence or two explaining what this command does\" ]," >> "$F" + echo " \"description\": [ \"See \" ]," >> "$F" + echo " \"support\": [ \"undocumented\" ]," >> "$F" + echo " \"avail\": \"0.0.0\"," >> "$F" + echo " \"hook\": \"undocumented\"," >> "$F" - echo " \"resp-syntax\": \"Syntax of the response\"," >> $F - echo " \"resp-comment\": \"Optional extra comments after the resposne syntax.\"" >> $F - echo "}" >> $F + echo " \"cmd-syntax\": [ \"Syntax of the command\" ]," >> "$F" + echo " \"cmd-comment\": [ \"Possibly some extra comments after the syntax.\" ]," >> "$F" + + echo " \"resp-syntax\": [ \"Syntax of the response\" ]," >> "$F" + echo " \"resp-comment\": [ \"Optional extra comments after the resposne syntax.\" ]" >> "$F" + echo "}" >> "$F" echo "$CMD generated." -done < $1 +done < "$1"