Skip to content

Commit

Permalink
better usage info from flag
Browse files Browse the repository at this point in the history
  • Loading branch information
gwirn committed Jan 4, 2024
1 parent d531c84 commit a4fd5a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ From within the base directory of this repository run following commands
```
git clone https://github.com/gwirn/golaf.git
cd golaf/src
go build
mv src golaf
go build -o golaf
```

After running the commands above, on unix systems you can either do `mv golaf /usr/bin` or run `echo 'alias golaf="/PATH/TO/GOLAF"' >> ~/.bashrc` (or `~/.zshrc` depending on your shell) in order to make **GOLAF** easier accessible.
Expand Down
8 changes: 6 additions & 2 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ Parse command line arguments and execute search over files or stdin
:return
*/
func argparse() {
flag.Usage = func() {
fmt.Printf("SYNOPSIS %s [-gapp] [-mmp] [-match] [-quality] [-color] [pattern] [file ...]\n", os.Args[0])
flag.PrintDefaults()
}
// optional arguments
// gap penalty
gapPenaltyPtr := flag.Int("gapp", -2, "gap penalty [NEGATIVE]")
Expand All @@ -267,9 +271,9 @@ func argparse() {
flag.Visit(func(f *flag.Flag) {
numFalgsPassed++
})
numArgs := len(os.Args)
if numArgs == 1 {
if len(flag.Args()) == 0 {
fmt.Fprintf(os.Stderr, "No arguments supplied\n")
flag.Usage()
os.Exit(1)
}

Expand Down

0 comments on commit a4fd5a4

Please sign in to comment.