-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add single flag help * add search option, usage: --help search * remove flag search * add examples * minor linting improvements Co-authored-by: mzack <marco.rivoli.nvh@gmail.com>
- Loading branch information
1 parent
f244b47
commit b7481f4
Showing
3 changed files
with
60 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/projectdiscovery/goflags" | ||
) | ||
|
||
type Options struct { | ||
name string | ||
Email goflags.StringSlice | ||
Phone string | ||
Address goflags.StringSlice | ||
} | ||
|
||
func main() { | ||
testOptions := &Options{} | ||
flagSet := goflags.NewFlagSet() | ||
flagSet.CreateGroup("info", "Info", | ||
flagSet.StringVarP(&testOptions.name, "name", "n", "", "name of the user"), | ||
flagSet.StringSliceVarP(&testOptions.Email, "email", "e", nil, "email of the user", goflags.CommaSeparatedStringSliceOptions), | ||
) | ||
flagSet.CreateGroup("additional", "Additional", | ||
flagSet.StringVarP(&testOptions.Phone, "phone", "ph", "", "phone of the user"), | ||
flagSet.StringSliceVarP(&testOptions.Address, "address", "add", nil, "address of the user", goflags.StringSliceOptions), | ||
) | ||
|
||
if err := flagSet.Parse(); err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters