-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor code * complete refactor * Update errors and fix lint * Add graceful exit on command line signals * Add GoReleaser config Signed-off-by: Azunna Ikonne <[email protected]>
- Loading branch information
Showing
40 changed files
with
821 additions
and
639 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
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
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,6 @@ | ||
builds: | ||
- flags: | ||
- -tags={{.Tag}} | ||
- -v | ||
- ldflags: | ||
- -s -w -X main.version={{.Version}} -X main.date={{.Date}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package arguments | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/jessevdk/go-flags" | ||
) | ||
|
||
type cmdArgs struct { | ||
// Example of verbosity with level | ||
Verbose []bool `short:"v" long:"verbose" description:"Show verbose output"` | ||
Release string `long:"release" choice:"stable" choice:"weekly" choice:"live" choice:"bare" default:"stable" description:"The docker image tag to use"` | ||
Port *int `long:"port" default:"8080" description:"Initialize ZAP with a custom port."` | ||
Pull bool `short:"p" long:"pull" description:"Pull the latest ZAP image from dockerhub"` | ||
Configs []string `long:"opts" description:"Additional ZAP command line options to use when initializing ZAP"` | ||
} | ||
|
||
var Options cmdArgs | ||
var Parser = flags.NewParser(&Options, flags.Default) | ||
|
||
func CheckArgs() { | ||
introtext := `ZapGo is a command line utility for dynamic security testing based on the OWASP ZAP Project. | ||
See zapgo --help for usage details.` | ||
|
||
if _, err := Parser.Parse(); err != nil { | ||
if len(os.Args) == 1 { | ||
fmt.Println(introtext) | ||
} | ||
switch flagsErr := err.(type) { | ||
case flags.ErrorType: | ||
if flagsErr == flags.ErrHelp { | ||
os.Exit(0) | ||
} | ||
os.Exit(1) | ||
default: | ||
os.Exit(1) | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.