Skip to content

Commit

Permalink
minor default entrypoint docker create, remove default from cli in pr…
Browse files Browse the repository at this point in the history
…ep of local use
  • Loading branch information
majodev committed Dec 19, 2024
1 parent e5a158c commit 1fb9f5c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 13 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ COPY --from=builder /app/bin/app /app/

# default entrypoint is the new go binary already
ENTRYPOINT ["/app/app"]
CMD ["create"]

# distroless disabled for now, until we switch to the full go based version (without the above bash reference implementation)
# FROM bitnami/kubectl:1.28 as kubectl
Expand Down
2 changes: 1 addition & 1 deletion cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// createCmd represents the create command
var createCmd = &cobra.Command{
Use: "create",
Short: "(DEFAULT) Creates an application-aware snapshot",
Short: "Creates an application-aware snapshot",
// Long: `...`,
Run: runCreate,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/mysql_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// mysqlRestoreCmd represents the restore command
var mysqlRestoreCmd = &cobra.Command{
Use: "restore",
Short: "Connects to the live mysql/mariadb container and restores the database dump",
Short: "Connects to the live mysql/mariadb container and restores a preexisting database dump",
// Long: `...`,
Run: func(_ *cobra.Command, _ []string) {
config := lib.LoadConfig()
Expand Down
2 changes: 1 addition & 1 deletion cmd/postgres_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// postgresRestoreCmd represents the dump command
var postgresRestoreCmd = &cobra.Command{
Use: "restore",
Short: "Connects to the live postgres container and restores the database dump",
Short: "Connects to the live postgres container and restores a preexisting database dump",
// Long: `...`,
Run: func(_ *cobra.Command, _ []string) {
config := lib.LoadConfig()
Expand Down
10 changes: 0 additions & 10 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package cmd

import (
"errors"
"fmt"
"os"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

// rootCmd represents the base command when called without any subcommands
Expand All @@ -22,14 +20,6 @@ var rootCmd = &cobra.Command{
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
cmd, _, err := rootCmd.Find(os.Args[1:])
// default cmd if no cmd is given
// https://github.com/spf13/cobra/issues/823
if err == nil && cmd.Use == rootCmd.Use && !errors.Is(cmd.Flags().Parse(os.Args[1:]), pflag.ErrHelp) {
args := append([]string{createCmd.Use}, os.Args[1:]...)
rootCmd.SetArgs(args)
}

if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
Expand Down

0 comments on commit 1fb9f5c

Please sign in to comment.