Browse Source

style of code

develop
Simon Vieille 1 month ago
parent
commit
5d4ae9ade2
Signed by: Simon Vieille <simon@deblan.fr> GPG Key ID: 03383D15A1D31745
1 changed files with 19 additions and 12 deletions
  1. 19
    12
      bin/vacuum

+ 19
- 12
bin/vacuum View File

@@ -1,13 +1,15 @@
1 1
 #!/bin/sh
2 2
 
3 3
 usage() {
4
-	printf "Usage: %s [url] [filters] [-h|--help|--wget|--httrack]\n\n" "$0"
4
+	cat << EOF
5
+Usage: $0 [url] [filters] [-h|--help|--wget|--httrack]
5 6
 
6
-	printf "  --wget      Select GNU Wget\n"
7
-	printf "  --httrack   Select httrack to vacuum\n"
8
-	printf "  -h,--help   Show this help\n\n"
7
+  --wget      Select GNU Wget
8
+  --httrack   Select httrack to vacuum
9
+  -h,--help   Show this help
9 10
 
10
-	printf "Filters only work with httrack. \`man httrack\` to get help.\n"
11
+Filters only work with httrack. \`man httrack\` to get help
12
+EOF
11 13
 }
12 14
 
13 15
 for i in "$@"; do
@@ -34,8 +36,6 @@ fi
34 36
 
35 37
 if [ -z "$TOOL" ]; then
36 38
 	while test -z "$TOOL"; do
37
-		printf ""
38
-
39 39
 		printf "Vacuum:\n"
40 40
 		printf "  [1] httrack\n"
41 41
 		printf "  [2] wget\n"
@@ -57,9 +57,16 @@ if [ -z "$TOOL" ]; then
57 57
 fi
58 58
 
59 59
 if [ "$TOOL" = "httrack" ]; then
60
-	printf "\nCommand:\n\n  httrack %s\n\n" "$URL"
61
-	httrack $URL
62
-elif [ "$TOOL" = "wget" ]; then
63
-	printf "\nCommand:\n\n  wget --progress=bar -E -r -k -np --no-check-certificate --user-agent=Firefox \"%s\"\n\n" "$URL"
64
-	wget --progress=bar -E -r -k -np --no-check-certificate --user-agent=Firefox $URL
60
+	COMMAND="httrack $URL"
61
+else
62
+	COMMAND="wget --progress=bar -E -r -k -np --no-check-certificate --user-agent=Firefox $URL"
65 63
 fi
64
+
65
+cat << EOF
66
+Command:
67
+
68
+  $COMMAND
69
+
70
+EOF
71
+
72
+exec $COMMAND

Loading…
Cancel
Save