mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
feat(aliases): add aliases for namespaces
command
- `namespace`, `ns`, `user`, `users` are aliases for `namespaces` command - `c`, `new` are aliases for the `create` subcommand - `delete` is an alias for the `destroy` subcommand - `mv` is an alias for the `rename` subcommand - `ls`, `show` are aliases for the `list` subcommand
This commit is contained in:
parent
aff6b84250
commit
5310f8692b
1 changed files with 15 additions and 10 deletions
|
@ -25,13 +25,15 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var namespaceCmd = &cobra.Command{
|
var namespaceCmd = &cobra.Command{
|
||||||
Use: "namespaces",
|
Use: "namespaces",
|
||||||
Short: "Manage the namespaces of Headscale",
|
Short: "Manage the namespaces of Headscale",
|
||||||
|
Aliases: []string{"namespace", "ns", "user", "users"},
|
||||||
}
|
}
|
||||||
|
|
||||||
var createNamespaceCmd = &cobra.Command{
|
var createNamespaceCmd = &cobra.Command{
|
||||||
Use: "create NAME",
|
Use: "create NAME",
|
||||||
Short: "Creates a new namespace",
|
Short: "Creates a new namespace",
|
||||||
|
Aliases: []string{"c", "new"},
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
return errMissingParameter
|
return errMissingParameter
|
||||||
|
@ -72,8 +74,9 @@ var createNamespaceCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
var destroyNamespaceCmd = &cobra.Command{
|
var destroyNamespaceCmd = &cobra.Command{
|
||||||
Use: "destroy NAME",
|
Use: "destroy NAME",
|
||||||
Short: "Destroys a namespace",
|
Short: "Destroys a namespace",
|
||||||
|
Aliases: []string{"delete"},
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
return errMissingParameter
|
return errMissingParameter
|
||||||
|
@ -144,8 +147,9 @@ var destroyNamespaceCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
var listNamespacesCmd = &cobra.Command{
|
var listNamespacesCmd = &cobra.Command{
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "List all the namespaces",
|
Short: "List all the namespaces",
|
||||||
|
Aliases: []string{"ls", "show"},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
output, _ := cmd.Flags().GetString("output")
|
output, _ := cmd.Flags().GetString("output")
|
||||||
|
|
||||||
|
@ -197,8 +201,9 @@ var listNamespacesCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
var renameNamespaceCmd = &cobra.Command{
|
var renameNamespaceCmd = &cobra.Command{
|
||||||
Use: "rename OLD_NAME NEW_NAME",
|
Use: "rename OLD_NAME NEW_NAME",
|
||||||
Short: "Renames a namespace",
|
Short: "Renames a namespace",
|
||||||
|
Aliases: []string{"mv"},
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
expectedArguments := 2
|
expectedArguments := 2
|
||||||
if len(args) < expectedArguments {
|
if len(args) < expectedArguments {
|
||||||
|
|
Loading…
Reference in a new issue