Skip to content

Commit c118c5e

Browse files
committed
Add command-line help menu
1 parent 766d65f commit c118c5e

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Main.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,24 @@ import (
99
translator "go-googletrans"
1010
)
1111

12+
const APP_VERSION string = "1.0"
13+
1214
func Help(exitCode int) {
13-
fmt.Println("Help menu")
15+
fmt.Printf("SubtitleTranslator v%s.\n", APP_VERSION)
16+
fmt.Print("\n")
17+
fmt.Println("Valid switches:")
18+
fmt.Println("-i, --in, --input\t\tSpecify the input file path.")
19+
fmt.Println("-o, --out, --output\t\tSpecify the file path to ouput translated file.")
20+
fmt.Println("-s, --src, --source\t\tSpecify the source file's language. (Set to 'auto' by default).")
21+
fmt.Println("-d, --dst, --destination\tSpecify the language to translate to. (Set to 'English (en)' by default).")
22+
fmt.Println("-q, --quiet\t\t\tDon't output translation results in terminal.")
23+
fmt.Print("\n")
24+
fmt.Println("Valid usages:")
25+
fmt.Println("Convert from any language implicitly to English: 'SubtitleTranslator -i InputFile.srt -o OutputFile.srt'")
26+
fmt.Println("Convert explicitly from Turkish implicitly to English: 'SubtitleTranslator -i InputFile.srt -o OutputFile.srt -s tr")
27+
fmt.Println("Convert explicitly from Turkish implicitly to English: 'SubtitleTranslator -i InputFile.srt -o OutputFile.srt -s tr")
28+
fmt.Println("Convert explicitly from English explicitly to Urdu: 'SubtitleTranslator -i InputFile.srt -o OutputFile.srt -s en -d ur")
29+
1430
os.Exit(exitCode)
1531
}
1632

@@ -79,7 +95,7 @@ func main() {
7995
i++
8096
SrcLanguage = os.Args[i]
8197
validArgFound = true
82-
case "-d", "--dest", "--destination":
98+
case "-d", "--dst", "--destination":
8399
Assert(i+1 < len(os.Args), "Switch "+"\""+currentArg+"\""+" is missing an argument!")
84100
i++
85101
DstLanguage = os.Args[i]

0 commit comments

Comments
 (0)