Skip to content

Commit

Permalink
chore(flags): clean up flag parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
xizhao committed Jan 29, 2018
1 parent 41c2d3e commit 0e20f0b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/fossa/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func main() {
cli.BoolFlag{Name: "install, i", Usage: "run a default build in module directories if they have not been pre-built"},
cli.BoolFlag{Name: "output, o", Usage: "output build data to JSON and exit; do not upload results to FOSSA"},
cli.StringFlag{Name: "log_level, l"},
cli.StringFlag{Name: "locator"},
}

app.Commands = []cli.Command{
Expand All @@ -51,10 +52,8 @@ func main() {
Action: BuildCmd,
Flags: []cli.Flag{
// Format: `type:path` e.g. `gopackage:github.com/fossas/fossa-cli/cmd/fossa`
cli.StringFlag{Name: "locator"},
cli.StringFlag{Name: "entry_point, e"},
cli.StringFlag{Name: "type, t"},
cli.BoolFlag{Name: "install, i", Usage: "run a default build in module directories if they have not been pre-built"},
cli.BoolFlag{Name: "upload, u"},
cli.BoolFlag{Name: "no_cache"},
},
Expand Down Expand Up @@ -101,7 +100,6 @@ func BootstrapCmd(c *cli.Context) error {

// Read configuration file.
config, err := ReadConfig(c.String("config"))
log.Logger.Debugf("Configuration: %+v\n", config)
if err != nil {
log.Logger.Fatalf("error initializing: %s", err)
}
Expand All @@ -113,7 +111,7 @@ func BootstrapCmd(c *cli.Context) error {
config.CLI.LogLevel = logLevelFlag
}

// // Analysis flags.
// Analysis flags.
entryPointFlag := c.String("entry_point")
if entryPointFlag != "" {
entryPointSections := strings.Split(entryPointFlag, "")
Expand Down Expand Up @@ -142,7 +140,7 @@ func BootstrapCmd(c *cli.Context) error {
config.CLI.NoCache = true
}

// // Upload flags.
// Upload flags.
endpointFlag := c.String("endpoint")
if endpointFlag != "" {
config.CLI.Server = endpointFlag
Expand All @@ -166,6 +164,8 @@ func BootstrapCmd(c *cli.Context) error {
log.Logger.Fatal("could not infer project name from either `.fossa.yaml` or `git` remote named `origin`")
}

log.Logger.Debugf("Configuration: %+v\n", config)

context.config = config
return nil
}
Expand Down

0 comments on commit 0e20f0b

Please sign in to comment.