diff --git a/cmd/dagger/cmd/input/container.go b/cmd/dagger/cmd/input/container.go new file mode 100644 index 00000000..5187ca9b --- /dev/null +++ b/cmd/dagger/cmd/input/container.go @@ -0,0 +1,31 @@ +package input + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var containerCmd = &cobra.Command{ + Use: "container ID", + Short: "Add a container image as input artifact", + Args: cobra.ExactArgs(1), + PreRun: func(cmd *cobra.Command, args []string) { + // Fix Viper bug for duplicate flags: + // https://github.com/spf13/viper/issues/233 + if err := viper.BindPFlags(cmd.Flags()); err != nil { + panic(err) + } + }, + Run: func(cmd *cobra.Command, args []string) { + // lg := logger.New() + // ctx := lg.WithContext(cmd.Context()) + + panic("not implemented") + }, +} + +func init() { + if err := viper.BindPFlags(containerCmd.Flags()); err != nil { + panic(err) + } +} diff --git a/cmd/dagger/cmd/input/dir.go b/cmd/dagger/cmd/input/dir.go new file mode 100644 index 00000000..170aa955 --- /dev/null +++ b/cmd/dagger/cmd/input/dir.go @@ -0,0 +1,31 @@ +package input + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var dirCmd = &cobra.Command{ + Use: "dir PATH", + Short: "Add a local directory as input artifact", + Args: cobra.ExactArgs(1), + PreRun: func(cmd *cobra.Command, args []string) { + // Fix Viper bug for duplicate flags: + // https://github.com/spf13/viper/issues/233 + if err := viper.BindPFlags(cmd.Flags()); err != nil { + panic(err) + } + }, + Run: func(cmd *cobra.Command, args []string) { + // lg := logger.New() + // ctx := lg.WithContext(cmd.Context()) + + panic("not implemented") + }, +} + +func init() { + if err := viper.BindPFlags(dirCmd.Flags()); err != nil { + panic(err) + } +} diff --git a/cmd/dagger/cmd/input/git.go b/cmd/dagger/cmd/input/git.go new file mode 100644 index 00000000..3452f1a7 --- /dev/null +++ b/cmd/dagger/cmd/input/git.go @@ -0,0 +1,31 @@ +package input + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var gitCmd = &cobra.Command{ + Use: "git REMOTE REF [SUBDIR]", + Short: "Add a git repository as input artifact", + Args: cobra.MinimumNArgs(2), + PreRun: func(cmd *cobra.Command, args []string) { + // Fix Viper bug for duplicate flags: + // https://github.com/spf13/viper/issues/233 + if err := viper.BindPFlags(cmd.Flags()); err != nil { + panic(err) + } + }, + Run: func(cmd *cobra.Command, args []string) { + // lg := logger.New() + // ctx := lg.WithContext(cmd.Context()) + + panic("not implemented") + }, +} + +func init() { + if err := viper.BindPFlags(gitCmd.Flags()); err != nil { + panic(err) + } +} diff --git a/cmd/dagger/cmd/input/root.go b/cmd/dagger/cmd/input/root.go new file mode 100644 index 00000000..a8cb9f06 --- /dev/null +++ b/cmd/dagger/cmd/input/root.go @@ -0,0 +1,19 @@ +package input + +import "github.com/spf13/cobra" + +// Cmd exposes the top-level command +var Cmd = &cobra.Command{ + Use: "input", + Short: "Manage a route's inputs", +} + +func init() { + Cmd.AddCommand( + dirCmd, + gitCmd, + containerCmd, + secretCmd, + valueCmd, + ) +} diff --git a/cmd/dagger/cmd/input/secret.go b/cmd/dagger/cmd/input/secret.go new file mode 100644 index 00000000..b1abd078 --- /dev/null +++ b/cmd/dagger/cmd/input/secret.go @@ -0,0 +1,31 @@ +package input + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var secretCmd = &cobra.Command{ + Use: "secret VALUE", + Short: "Add an encrypted input secret", + Args: cobra.ExactArgs(1), + PreRun: func(cmd *cobra.Command, args []string) { + // Fix Viper bug for duplicate flags: + // https://github.com/spf13/viper/issues/233 + if err := viper.BindPFlags(cmd.Flags()); err != nil { + panic(err) + } + }, + Run: func(cmd *cobra.Command, args []string) { + // lg := logger.New() + // ctx := lg.WithContext(cmd.Context()) + + panic("not implemented") + }, +} + +func init() { + if err := viper.BindPFlags(secretCmd.Flags()); err != nil { + panic(err) + } +} diff --git a/cmd/dagger/cmd/input/value.go b/cmd/dagger/cmd/input/value.go new file mode 100644 index 00000000..f8573493 --- /dev/null +++ b/cmd/dagger/cmd/input/value.go @@ -0,0 +1,31 @@ +package input + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var valueCmd = &cobra.Command{ + Use: "value VALUE", + Short: "Add an input value", + Args: cobra.ExactArgs(1), + PreRun: func(cmd *cobra.Command, args []string) { + // Fix Viper bug for duplicate flags: + // https://github.com/spf13/viper/issues/233 + if err := viper.BindPFlags(cmd.Flags()); err != nil { + panic(err) + } + }, + Run: func(cmd *cobra.Command, args []string) { + // lg := logger.New() + // ctx := lg.WithContext(cmd.Context()) + + panic("not implemented") + }, +} + +func init() { + if err := viper.BindPFlags(valueCmd.Flags()); err != nil { + panic(err) + } +} diff --git a/cmd/dagger/cmd/layout/dir.go b/cmd/dagger/cmd/layout/dir.go new file mode 100644 index 00000000..21a1fc4f --- /dev/null +++ b/cmd/dagger/cmd/layout/dir.go @@ -0,0 +1,31 @@ +package layout + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var dirCmd = &cobra.Command{ + Use: "dir PATH", + Short: "Load layout from a local directory", + Args: cobra.ExactArgs(1), + PreRun: func(cmd *cobra.Command, args []string) { + // Fix Viper bug for duplicate flags: + // https://github.com/spf13/viper/issues/233 + if err := viper.BindPFlags(cmd.Flags()); err != nil { + panic(err) + } + }, + Run: func(cmd *cobra.Command, args []string) { + // lg := logger.New() + // ctx := lg.WithContext(cmd.Context()) + + panic("not implemented") + }, +} + +func init() { + if err := viper.BindPFlags(dirCmd.Flags()); err != nil { + panic(err) + } +} diff --git a/cmd/dagger/cmd/layout/file.go b/cmd/dagger/cmd/layout/file.go new file mode 100644 index 00000000..de503531 --- /dev/null +++ b/cmd/dagger/cmd/layout/file.go @@ -0,0 +1,31 @@ +package layout + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var fileCmd = &cobra.Command{ + Use: "file PATH|-", + Short: "Load layout from a cue file", + Args: cobra.ExactArgs(1), + PreRun: func(cmd *cobra.Command, args []string) { + // Fix Viper bug for duplicate flags: + // https://github.com/spf13/viper/issues/233 + if err := viper.BindPFlags(cmd.Flags()); err != nil { + panic(err) + } + }, + Run: func(cmd *cobra.Command, args []string) { + // lg := logger.New() + // ctx := lg.WithContext(cmd.Context()) + + panic("not implemented") + }, +} + +func init() { + if err := viper.BindPFlags(fileCmd.Flags()); err != nil { + panic(err) + } +} diff --git a/cmd/dagger/cmd/layout/git.go b/cmd/dagger/cmd/layout/git.go new file mode 100644 index 00000000..dd4ca02d --- /dev/null +++ b/cmd/dagger/cmd/layout/git.go @@ -0,0 +1,31 @@ +package layout + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var gitCmd = &cobra.Command{ + Use: "git REMOTE REF [SUBDIR]", + Short: "Load layout from a git package", + Args: cobra.MinimumNArgs(2), + PreRun: func(cmd *cobra.Command, args []string) { + // Fix Viper bug for duplicate flags: + // https://github.com/spf13/viper/issues/233 + if err := viper.BindPFlags(cmd.Flags()); err != nil { + panic(err) + } + }, + Run: func(cmd *cobra.Command, args []string) { + // lg := logger.New() + // ctx := lg.WithContext(cmd.Context()) + + panic("not implemented") + }, +} + +func init() { + if err := viper.BindPFlags(gitCmd.Flags()); err != nil { + panic(err) + } +} diff --git a/cmd/dagger/cmd/layout/package.go b/cmd/dagger/cmd/layout/package.go new file mode 100644 index 00000000..e8705d7a --- /dev/null +++ b/cmd/dagger/cmd/layout/package.go @@ -0,0 +1,31 @@ +package layout + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var packageCmd = &cobra.Command{ + Use: "package PKG", + Short: "Load layout from a cue package", + Args: cobra.ExactArgs(1), + PreRun: func(cmd *cobra.Command, args []string) { + // Fix Viper bug for duplicate flags: + // https://github.com/spf13/viper/issues/233 + if err := viper.BindPFlags(cmd.Flags()); err != nil { + panic(err) + } + }, + Run: func(cmd *cobra.Command, args []string) { + // lg := logger.New() + // ctx := lg.WithContext(cmd.Context()) + + panic("not implemented") + }, +} + +func init() { + if err := viper.BindPFlags(packageCmd.Flags()); err != nil { + panic(err) + } +} diff --git a/cmd/dagger/cmd/layout/root.go b/cmd/dagger/cmd/layout/root.go new file mode 100644 index 00000000..9f968a5c --- /dev/null +++ b/cmd/dagger/cmd/layout/root.go @@ -0,0 +1,18 @@ +package layout + +import "github.com/spf13/cobra" + +// Cmd exposes the top-level command +var Cmd = &cobra.Command{ + Use: "layout", + Short: "Manage a route's layout", +} + +func init() { + Cmd.AddCommand( + packageCmd, + dirCmd, + gitCmd, + fileCmd, + ) +} diff --git a/cmd/dagger/cmd/output/dir.go b/cmd/dagger/cmd/output/dir.go new file mode 100644 index 00000000..9de621d3 --- /dev/null +++ b/cmd/dagger/cmd/output/dir.go @@ -0,0 +1,31 @@ +package output + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var dirCmd = &cobra.Command{ + Use: "dir PATH", + Short: "Add a local directory as output artifact", + Args: cobra.ExactArgs(1), + PreRun: func(cmd *cobra.Command, args []string) { + // Fix Viper bug for duplicate flags: + // https://github.com/spf13/viper/issues/233 + if err := viper.BindPFlags(cmd.Flags()); err != nil { + panic(err) + } + }, + Run: func(cmd *cobra.Command, args []string) { + // lg := logger.New() + // ctx := lg.WithContext(cmd.Context()) + + panic("not implemented") + }, +} + +func init() { + if err := viper.BindPFlags(dirCmd.Flags()); err != nil { + panic(err) + } +} diff --git a/cmd/dagger/cmd/output/root.go b/cmd/dagger/cmd/output/root.go new file mode 100644 index 00000000..057c9a37 --- /dev/null +++ b/cmd/dagger/cmd/output/root.go @@ -0,0 +1,15 @@ +package output + +import "github.com/spf13/cobra" + +// Cmd exposes the top-level command +var Cmd = &cobra.Command{ + Use: "output", + Short: "Manage a route's outputs", +} + +func init() { + Cmd.AddCommand( + dirCmd, + ) +} diff --git a/cmd/dagger/cmd/query.go b/cmd/dagger/cmd/query.go index 913b03a5..e60f6a47 100644 --- a/cmd/dagger/cmd/query.go +++ b/cmd/dagger/cmd/query.go @@ -11,7 +11,7 @@ import ( ) var queryCmd = &cobra.Command{ - Use: "query", + Use: "query [EXPR] [flags]", Short: "Query the contents of a route", Args: cobra.ExactArgs(1), PreRun: func(cmd *cobra.Command, args []string) { diff --git a/cmd/dagger/cmd/root.go b/cmd/dagger/cmd/root.go index 31864c98..420c2b8e 100644 --- a/cmd/dagger/cmd/root.go +++ b/cmd/dagger/cmd/root.go @@ -4,6 +4,9 @@ import ( "os" "strings" + inputCmd "dagger.io/go/cmd/dagger/cmd/input" + "dagger.io/go/cmd/dagger/cmd/layout" + "dagger.io/go/cmd/dagger/cmd/output" "dagger.io/go/cmd/dagger/logger" "github.com/moby/buildkit/util/appcontext" "github.com/opentracing/opentracing-go" @@ -33,6 +36,9 @@ func init() { historyCmd, loginCmd, logoutCmd, + layout.Cmd, + inputCmd.Cmd, + output.Cmd, ) if err := viper.BindPFlags(rootCmd.PersistentFlags()); err != nil {