34 lines
822 B
Go
34 lines
822 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
func initConfig() {
|
|
config = Config{
|
|
DryRun: false,
|
|
Verbose: false,
|
|
Interactive: false,
|
|
LogsDir: "./logs",
|
|
RunsDir: "./runs",
|
|
}
|
|
|
|
os.MkdirAll("logs", 0o755)
|
|
}
|
|
|
|
func main() {
|
|
initConfig()
|
|
|
|
runCmd.Flags().BoolVar(&config.DryRun, "dry", false, "Show what would run without executing")
|
|
runCmd.Flags().BoolVarP(&config.Verbose, "verbose", "v", false, "Show script output in terminal")
|
|
runCmd.Flags().BoolVarP(&config.Interactive, "interactive", "i", false, "Run script interactively (show output and allow input)")
|
|
|
|
// This prevents Cobra from consuming -- and everything after it
|
|
runCmd.Flags().SetInterspersed(false)
|
|
|
|
rootCmd.AddCommand(runCmd, listCmd, newCmd, pushCmd, depsCmd, completionCmd)
|
|
|
|
if err := rootCmd.Execute(); err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|