more basic commands + lint fixes
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
84188535f3
commit
661affa4cb
31
cmd/dagger/cmd/delete.go
Normal file
31
cmd/dagger/cmd/delete.go
Normal file
@ -0,0 +1,31 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var deleteCmd = &cobra.Command{
|
||||
Use: "delete",
|
||||
Short: "Delete a route after taking it offline (WARNING: may destroy infrastructure)",
|
||||
Args: cobra.NoArgs,
|
||||
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(deleteCmd.Flags()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
// nolint:dupl
|
||||
package cmd
|
||||
|
||||
import (
|
||||
@ -21,6 +22,7 @@ var downCmd = &cobra.Command{
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
lg := logger.New()
|
||||
// nolint:staticcheck
|
||||
ctx := lg.WithContext(cmd.Context())
|
||||
|
||||
routeName := getRouteName(lg, cmd)
|
||||
@ -37,9 +39,9 @@ var downCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func init() {
|
||||
newCmd.Flags().Bool("--no-cache", false, "Disable all run cache")
|
||||
downCmd.Flags().Bool("--no-cache", false, "Disable all run cache")
|
||||
|
||||
if err := viper.BindPFlags(newCmd.Flags()); err != nil {
|
||||
if err := viper.BindPFlags(downCmd.Flags()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
31
cmd/dagger/cmd/history.go
Normal file
31
cmd/dagger/cmd/history.go
Normal file
@ -0,0 +1,31 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var historyCmd = &cobra.Command{
|
||||
Use: "history",
|
||||
Short: "List past changes to a route",
|
||||
Args: cobra.NoArgs,
|
||||
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(historyCmd.Flags()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
31
cmd/dagger/cmd/login.go
Normal file
31
cmd/dagger/cmd/login.go
Normal file
@ -0,0 +1,31 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var loginCmd = &cobra.Command{
|
||||
Use: "login",
|
||||
Short: "Login to Dagger Cloud",
|
||||
Args: cobra.NoArgs,
|
||||
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(loginCmd.Flags()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
31
cmd/dagger/cmd/logout.go
Normal file
31
cmd/dagger/cmd/logout.go
Normal file
@ -0,0 +1,31 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var logoutCmd = &cobra.Command{
|
||||
Use: "logout",
|
||||
Short: "Logout from Dagger Cloud",
|
||||
Args: cobra.NoArgs,
|
||||
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(logoutCmd.Flags()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ var queryCmd = &cobra.Command{
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
lg := logger.New()
|
||||
// nolint:staticcheck
|
||||
ctx := lg.WithContext(cmd.Context())
|
||||
|
||||
routeName := getRouteName(lg, cmd)
|
||||
@ -45,14 +46,14 @@ var queryCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func init() {
|
||||
newCmd.Flags().String("revision", "latest", "Query a specific version of the route")
|
||||
newCmd.Flags().StringP("format", "f", "", "Output format (json|yaml|cue|text|env)")
|
||||
queryCmd.Flags().String("revision", "latest", "Query a specific version of the route")
|
||||
queryCmd.Flags().StringP("format", "f", "", "Output format (json|yaml|cue|text|env)")
|
||||
|
||||
newCmd.Flags().BoolP("--no-input", "I", false, "Exclude inputs from query")
|
||||
newCmd.Flags().BoolP("--no-output", "O", false, "Exclude outputs from query")
|
||||
newCmd.Flags().BoolP("--no-layout", "L", false, "Exclude outputs from query")
|
||||
queryCmd.Flags().BoolP("--no-input", "I", false, "Exclude inputs from query")
|
||||
queryCmd.Flags().BoolP("--no-output", "O", false, "Exclude outputs from query")
|
||||
queryCmd.Flags().BoolP("--no-layout", "L", false, "Exclude outputs from query")
|
||||
|
||||
if err := viper.BindPFlags(newCmd.Flags()); err != nil {
|
||||
if err := viper.BindPFlags(queryCmd.Flags()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,10 @@ func init() {
|
||||
queryCmd,
|
||||
upCmd,
|
||||
downCmd,
|
||||
deleteCmd,
|
||||
historyCmd,
|
||||
loginCmd,
|
||||
logoutCmd,
|
||||
)
|
||||
|
||||
if err := viper.BindPFlags(rootCmd.PersistentFlags()); err != nil {
|
||||
|
@ -1,3 +1,4 @@
|
||||
// nolint:dupl
|
||||
package cmd
|
||||
|
||||
import (
|
||||
@ -21,6 +22,7 @@ var upCmd = &cobra.Command{
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
lg := logger.New()
|
||||
// nolint:staticcheck
|
||||
ctx := lg.WithContext(cmd.Context())
|
||||
|
||||
routeName := getRouteName(lg, cmd)
|
||||
@ -39,7 +41,7 @@ var upCmd = &cobra.Command{
|
||||
func init() {
|
||||
newCmd.Flags().Bool("--no-cache", false, "Disable all run cache")
|
||||
|
||||
if err := viper.BindPFlags(newCmd.Flags()); err != nil {
|
||||
if err := viper.BindPFlags(upCmd.Flags()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user