func printUsage() { fmt.Printf("gauge -version %s\n", version.FullVersion()) fmt.Printf("Copyright %d ThoughtWorks, Inc.\n\n", time.Now().Year()) fmt.Println("Usage:") fmt.Println("\tgauge specs/") fmt.Println("\tgauge specs/spec_name.spec") fmt.Println("\nOptions:") flag.PrintDefaults() }
func printUsage() { fmt.Printf("gauge -version %s\n", version.CurrentGaugeVersion.String()) fmt.Printf("Copyright %d Thoughtworks\n\n", time.Now().Year()) fmt.Println("Usage:") fmt.Println("\tgauge specs/") fmt.Println("\tgauge specs/spec_name.spec") fmt.Println("\nOptions:") flag.PrintDefaults() }
func main() { flag.Parse() util.SetWorkingDir(*workingDir) initPackageFlags() validGaugeProject := true err := config.SetProjectRoot(flag.Args()) if err != nil { validGaugeProject = false } env.LoadEnv(*currentEnv) logger.Initialize(*logLevel) if *gaugeVersion && *machineReadable { printJSONVersion() } else if *machineReadable { fmt.Printf("flag '--machine-readable' can only be used with '--version' or '-v'\n\n") fmt.Printf("Usage:\n\n") flag.PrintDefaults() os.Exit(1) } else if *gaugeVersion { printVersion() } else if *initialize != "" { projectInit.InitializeProject(*initialize) } else if *installZip != "" && *installPlugin != "" { install.HandleInstallResult(install.InstallPluginFromZipFile(*installZip, *installPlugin), *installPlugin, true) } else if *installPlugin != "" { install.HandleInstallResult(install.InstallPlugin(*installPlugin, *pluginVersion), *installPlugin, true) } else if *uninstallPlugin != "" { install.UninstallPlugin(*uninstallPlugin, *pluginVersion) } else if *installAll { install.InstallAllPlugins() } else if *update != "" { install.HandleUpdateResult(install.InstallPlugin(*update, *pluginVersion), *update, true) } else if *updateAll { install.UpdatePlugins() } else if *checkUpdates { install.PrintUpdateInfoWithDetails() } else if *addPlugin != "" { install.AddPluginToProject(*addPlugin, *pluginArgs) } else if *listTemplates { projectInit.ListTemplates() } else if flag.NFlag() == 0 && len(flag.Args()) == 0 { printUsage() os.Exit(0) } else if validGaugeProject { var specDirs = []string{common.SpecsDirectoryName} if len(flag.Args()) > 0 { specDirs = flag.Args() } if *refactorSteps != "" { refactorInit(flag.Args()) } else if *daemonize { api.RunInBackground(*apiPort, specDirs) } else if *specFilesToFormat != "" { formatter.FormatSpecFilesIn(*specFilesToFormat) } else if *validate { validation.Validate(flag.Args()) } else { exitCode := execution.ExecuteSpecs(specDirs) os.Exit(exitCode) } } else { logger.Fatalf(err.Error()) } }