added input, output, layout cmds

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-03-23 17:05:30 -07:00 committed by Solomon Hykes
parent 37bf20e24b
commit 9c110716a5
15 changed files with 369 additions and 1 deletions

View 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)
}
}

View 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)
}
}

View 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)
}
}

View 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,
)
}

View 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)
}
}

View 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)
}
}

View 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)
}
}

View 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)
}
}

View 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)
}
}

View 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)
}
}

View 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,
)
}

View 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)
}
}

View 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,
)
}

View File

@ -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) {

View File

@ -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 {