-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from rsteube/add-docker-context
added docker context subcommand
- Loading branch information
Showing
10 changed files
with
215 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var contextCmd = &cobra.Command{ | ||
Use: "context", | ||
Short: "Manage contexts", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(contextCmd).Standalone() | ||
|
||
rootCmd.AddCommand(contextCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var context_createCmd = &cobra.Command{ | ||
Use: "create", | ||
Short: "Create a context", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(context_createCmd).Standalone() | ||
|
||
context_createCmd.Flags().String("default-stack-orchestrator", "", "Default orchestrator for stack operations to use with this context (swarm|kubernetes|all)") | ||
context_createCmd.Flags().String("description", "", "Description of the context") | ||
context_createCmd.Flags().String("docker", "", "set the docker endpoint (default [])") | ||
context_createCmd.Flags().String("from", "", "create context from a named context") | ||
context_createCmd.Flags().String("kubernetes", "", "set the kubernetes endpoint (default [])") | ||
contextCmd.AddCommand(context_createCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/completers/docker_completer/cmd/action" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var context_exportCmd = &cobra.Command{ | ||
Use: "export", | ||
Short: "Export a context to a tar or kubeconfig file", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(context_exportCmd).Standalone() | ||
|
||
context_exportCmd.Flags().Bool("kubeconfig", false, "Export as a kubeconfig file") | ||
contextCmd.AddCommand(context_exportCmd) | ||
|
||
carapace.Gen(context_exportCmd).PositionalCompletion( | ||
action.ActionContexts(), | ||
carapace.ActionFiles(""), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/completers/docker_completer/cmd/action" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var context_importCmd = &cobra.Command{ | ||
Use: "import", | ||
Short: "Import a context from a tar or zip file", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(context_importCmd).Standalone() | ||
|
||
contextCmd.AddCommand(context_importCmd) | ||
|
||
carapace.Gen(context_importCmd).PositionalCompletion( | ||
action.ActionContexts(), | ||
carapace.ActionFiles(""), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/completers/docker_completer/cmd/action" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var context_inspectCmd = &cobra.Command{ | ||
Use: "inspect", | ||
Short: "Display detailed information on one or more contexts", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(context_inspectCmd).Standalone() | ||
|
||
context_inspectCmd.Flags().StringP("format", "f", "", "Format the output using the given Go template") | ||
contextCmd.AddCommand(context_inspectCmd) | ||
|
||
carapace.Gen(context_inspectCmd).PositionalAnyCompletion(action.ActionContexts()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var context_lsCmd = &cobra.Command{ | ||
Use: "ls", | ||
Short: "List context", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(context_lsCmd).Standalone() | ||
|
||
context_lsCmd.Flags().String("format", "", "Pretty-print contexts using a Go template") | ||
context_lsCmd.Flags().BoolP("quiet", "q", false, "Only show context names") | ||
contextCmd.AddCommand(context_lsCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/completers/docker_completer/cmd/action" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var context_rmCmd = &cobra.Command{ | ||
Use: "rm", | ||
Short: "Remove one or more contexts", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(context_rmCmd).Standalone() | ||
|
||
context_rmCmd.Flags().BoolP("force", "f", false, "Force the removal of a context in use") | ||
contextCmd.AddCommand(context_rmCmd) | ||
|
||
carapace.Gen(context_rmCmd).PositionalAnyCompletion(action.ActionContexts()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/completers/docker_completer/cmd/action" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var context_updateCmd = &cobra.Command{ | ||
Use: "update", | ||
Short: "Update a context", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(context_updateCmd).Standalone() | ||
|
||
context_updateCmd.Flags().String("default-stack-orchestrator", "", "Default orchestrator for stack operations to use") | ||
context_updateCmd.Flags().String("description", "", "Description of the context") | ||
context_updateCmd.Flags().String("docker", "", "set the docker endpoint (default [])") | ||
context_updateCmd.Flags().String("kubernetes", "", "set the kubernetes endpoint (default [])") | ||
contextCmd.AddCommand(context_updateCmd) | ||
|
||
carapace.Gen(context_updateCmd).PositionalCompletion( | ||
action.ActionContexts(), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/completers/docker_completer/cmd/action" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var context_useCmd = &cobra.Command{ | ||
Use: "use", | ||
Short: "Set the current docker context", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(context_useCmd).Standalone() | ||
|
||
contextCmd.AddCommand(context_useCmd) | ||
|
||
carapace.Gen(context_useCmd).PositionalCompletion( | ||
action.ActionContexts(), | ||
) | ||
} |