main.go 822 B

12345678910111213141516171819202122232425262728293031323334
  1. package main
  2. import (
  3. "os"
  4. )
  5. func initConfig() {
  6. config = Config{
  7. DryRun: false,
  8. Verbose: false,
  9. Interactive: false,
  10. LogsDir: "./logs",
  11. RunsDir: "./runs",
  12. }
  13. os.MkdirAll("logs", 0o755)
  14. }
  15. func main() {
  16. initConfig()
  17. runCmd.Flags().BoolVar(&config.DryRun, "dry", false, "Show what would run without executing")
  18. runCmd.Flags().BoolVarP(&config.Verbose, "verbose", "v", false, "Show script output in terminal")
  19. runCmd.Flags().BoolVarP(&config.Interactive, "interactive", "i", false, "Run script interactively (show output and allow input)")
  20. // This prevents Cobra from consuming -- and everything after it
  21. runCmd.Flags().SetInterspersed(false)
  22. rootCmd.AddCommand(runCmd, listCmd, newCmd, pushCmd, depsCmd, completionCmd)
  23. if err := rootCmd.Execute(); err != nil {
  24. os.Exit(1)
  25. }
  26. }