mirror of
https://github.com/antonmedv/fx
synced 2024-11-03 15:40:12 +00:00
add flag: -h, --help (#218)
Change-Id: I6d5648b84536c22e518413d0360047431b1acccc
This commit is contained in:
parent
751e5865da
commit
95009b06b6
1
help.go
1
help.go
@ -22,6 +22,7 @@ func usage(keyMap KeyMap) string {
|
||||
curl ... | fx
|
||||
|
||||
%v
|
||||
-h, --help print help
|
||||
-v, --version print version
|
||||
--print-code print code of the reducer
|
||||
|
||||
|
7
main.go
7
main.go
@ -22,6 +22,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
flagHelp bool
|
||||
flagVersion bool
|
||||
flagPrintCode bool
|
||||
)
|
||||
@ -30,6 +31,8 @@ func main() {
|
||||
var args []string
|
||||
for _, arg := range os.Args[1:] {
|
||||
switch arg {
|
||||
case "-h", "--help":
|
||||
flagHelp = true
|
||||
case "-v", "-V", "--version":
|
||||
flagVersion = true
|
||||
case "--print-code":
|
||||
@ -39,6 +42,10 @@ func main() {
|
||||
}
|
||||
|
||||
}
|
||||
if flagHelp {
|
||||
fmt.Println(usage(DefaultKeyMap()))
|
||||
return
|
||||
}
|
||||
if flagVersion {
|
||||
fmt.Println(version)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user