added input, output, layout cmds
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
37bf20e24b
commit
9c110716a5
31
cmd/dagger/cmd/input/container.go
Normal file
31
cmd/dagger/cmd/input/container.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
31
cmd/dagger/cmd/input/dir.go
Normal file
31
cmd/dagger/cmd/input/dir.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
31
cmd/dagger/cmd/input/git.go
Normal file
31
cmd/dagger/cmd/input/git.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
19
cmd/dagger/cmd/input/root.go
Normal file
19
cmd/dagger/cmd/input/root.go
Normal file
@ -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,
|
||||
)
|
||||
}
|
31
cmd/dagger/cmd/input/secret.go
Normal file
31
cmd/dagger/cmd/input/secret.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
31
cmd/dagger/cmd/input/value.go
Normal file
31
cmd/dagger/cmd/input/value.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
31
cmd/dagger/cmd/layout/dir.go
Normal file
31
cmd/dagger/cmd/layout/dir.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
31
cmd/dagger/cmd/layout/file.go
Normal file
31
cmd/dagger/cmd/layout/file.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
31
cmd/dagger/cmd/layout/git.go
Normal file
31
cmd/dagger/cmd/layout/git.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
31
cmd/dagger/cmd/layout/package.go
Normal file
31
cmd/dagger/cmd/layout/package.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
18
cmd/dagger/cmd/layout/root.go
Normal file
18
cmd/dagger/cmd/layout/root.go
Normal file
@ -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,
|
||||
)
|
||||
}
|
31
cmd/dagger/cmd/output/dir.go
Normal file
31
cmd/dagger/cmd/output/dir.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
15
cmd/dagger/cmd/output/root.go
Normal file
15
cmd/dagger/cmd/output/root.go
Normal file
@ -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,
|
||||
)
|
||||
}
|
@ -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) {
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user