help
This commit is contained in:
parent
a3c6e4aeb5
commit
bbcf5aaa73
1 changed files with 12 additions and 1 deletions
13
main.go
13
main.go
|
|
@ -13,12 +13,23 @@ func main() {
|
||||||
exe, args := os.Args[0], os.Args[1:]
|
exe, args := os.Args[0], os.Args[1:]
|
||||||
exe = filepath.Base(exe)
|
exe = filepath.Base(exe)
|
||||||
|
|
||||||
if len(args) < 1 {
|
usage := func() {
|
||||||
fmt.Fprintf(os.Stderr, "usage: %s [file.riv] [file.html]\n", exe)
|
fmt.Fprintf(os.Stderr, "usage: %s [file.riv] [file.html]\n", exe)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(args) < 1 {
|
||||||
|
usage()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
inpath := args[0]
|
inpath := args[0]
|
||||||
|
for _, arg := range args {
|
||||||
|
if arg == "-h" || arg == "--help" {
|
||||||
|
usage()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
file, err := os.ReadFile(inpath)
|
file, err := os.ReadFile(inpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "error reading file: %v\n", err)
|
fmt.Fprintf(os.Stderr, "error reading file: %v\n", err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue