2023-07-20 09:26:25 +00:00
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
|
2023-08-02 15:00:34 +00:00
|
|
|
|
"git.badhouseplants.net/allanger/shoebill/internal/build"
|
2024-07-25 13:23:28 +00:00
|
|
|
|
"github.com/spf13/cobra"
|
2023-07-20 09:26:25 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var fullVersion = fmt.Sprintf("%s - %s", build.Version, build.CommitHash)
|
|
|
|
|
var longDescription = `---
|
2023-08-02 15:00:34 +00:00
|
|
|
|
shoebill is just GitOps with a glottal T
|
2023-07-20 09:26:25 +00:00
|
|
|
|
|
|
|
|
|
It's a tool that is supposed to help engineers follow the GitOps practies
|
|
|
|
|
without fighting with GitOps being inapplicable to the real world.
|
|
|
|
|
|
|
|
|
|
Yeah, I quite hate this GitOps obsession, but since it's already there,
|
|
|
|
|
I think it makes sense to make it work.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
Information about the build:
|
|
|
|
|
Version: %s (build on %s)
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
rootCmd = &cobra.Command{
|
2023-08-02 15:00:34 +00:00
|
|
|
|
Use: "shoebill",
|
|
|
|
|
Short: "shoebill – GitOps without pain, kinda",
|
2023-07-20 09:26:25 +00:00
|
|
|
|
Long: fmt.Sprintf(longDescription, fullVersion, build.BuildTime),
|
|
|
|
|
SilenceErrors: true,
|
|
|
|
|
SilenceUsage: true,
|
|
|
|
|
Version: build.Version,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Execute(ctx context.Context) error {
|
|
|
|
|
rootCmd.PersistentFlags().Bool("server", false, "Set to true, if you want to start it in the deamon mode")
|
|
|
|
|
if err := rootCmd.ExecuteContext(ctx); err != nil {
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Whoops. There was an error while executing your CLI '%s'", err)
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|