]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#201] Migrated script to /bin/sh, addresses shellcheck problems 201-migrate-script-to-bin-sh
authorTomek Mrugalski <tomasz@isc.org>
Thu, 8 Aug 2019 14:45:17 +0000 (16:45 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 2 Sep 2019 12:05:05 +0000 (08:05 -0400)
doc/sphinx/api/generate-templates

index 762bc1a687cdf7be1d99760390416def9a670b86..ac1f0d6a58ea12de8711a07ecd1428625cd0139e 100755 (executable)
@@ -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 <xref linkend=\\\"cmd-$LINE\\\"/>\"," >> $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 <xref linkend=\\\"cmd-$LINE\\\"/>\" ]," >> "$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"