Skip to content

Commit 97fd432

Browse files
committed
Add: Subcommand alias
1 parent 088f8f0 commit 97fd432

File tree

15 files changed

+67
-52
lines changed

15 files changed

+67
-52
lines changed

cmd/alias/list/list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import (
88

99
func NewAliasListCommand() *cobra.Command {
1010
aliasListCmd := &cobra.Command{
11-
Use: "list",
12-
Short: "List all alias",
13-
Long: "List all alias",
11+
Use: "list",
12+
Short: "List all alias",
13+
Long: "List all alias",
14+
Aliases: []string{"ls"},
1415
Run: func(cmd *cobra.Command, args []string) {
1516
configuration := config.LoadConfig()
1617
aliasController := alias.NewAliasController("", configuration, "")

cmd/create/caches/caches.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ const createType = "caches"
1212

1313
func NewCachesCommand() *cobra.Command {
1414
cachesCmd := &cobra.Command{
15-
Use: "caches <cache>",
16-
Short: "Create a alternate cache",
17-
Long: "Create a alternate cache",
15+
Use: "caches <cache>",
16+
Short: "Create a alternate cache",
17+
Long: "Create a alternate cache",
18+
Aliases: []string{"cache"},
1819
Run: func(cmd *cobra.Command, args []string) {
1920
newIp, _ := cmd.Flags().GetString("ip")
2021
newUser, _ := cmd.Flags().GetString("user")

cmd/create/create.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import (
1010

1111
func NewCreateCommand() *cobra.Command {
1212
createCmd := &cobra.Command{
13-
Use: "create [command]",
14-
Short: "Create alternate username, port number, password, and login cache information",
15-
Long: "Create alternate username, port number, password, and login cache information",
13+
Use: "create [command]",
14+
Short: "Create alternate username, port number, password, and login cache information",
15+
Long: "Create alternate username, port number, password, and login cache information",
16+
Aliases: []string{"cre", "crt", "add"},
1617
}
1718
createCmd.AddCommand(users.NewUsersCommand())
1819
createCmd.AddCommand(ports.NewPortsCommand())

cmd/create/passwords/passwords.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ const createType = "passwords"
1010

1111
func NewPasswordsCommand() *cobra.Command {
1212
passwordsCmd := &cobra.Command{
13-
Use: "passwords <password>",
14-
Args: cobra.ExactArgs(1),
15-
Short: "Create a alternate password",
16-
Long: "Create a alternate password",
13+
Use: "passwords <password>",
14+
Args: cobra.ExactArgs(1),
15+
Short: "Create a alternate password",
16+
Long: "Create a alternate password",
17+
Aliases: []string{"password", "pass", "pwd"},
1718
Run: func(cmd *cobra.Command, args []string) {
1819
password := args[0]
1920
configuration := config.LoadConfig()

cmd/create/ports/ports.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ const createType = "ports"
1010

1111
func NewPortsCommand() *cobra.Command {
1212
portsCmd := &cobra.Command{
13-
Use: "ports <port>",
14-
Args: cobra.ExactArgs(1),
15-
Short: "Create a alternate port",
16-
Long: "Create a alternate port",
13+
Use: "ports <port>",
14+
Args: cobra.ExactArgs(1),
15+
Short: "Create a alternate port",
16+
Long: "Create a alternate port",
17+
Aliases: []string{"port", "po"},
1718
Run: func(cmd *cobra.Command, args []string) {
1819
port := args[0]
1920
configuration := config.LoadConfig()

cmd/create/users/users.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ const createType = "users"
1010

1111
func NewUsersCommand() *cobra.Command {
1212
usersCmd := &cobra.Command{
13-
Use: "users <username>",
14-
Args: cobra.ExactArgs(1),
15-
Short: "Create a alternate username",
16-
Long: "Create a alternate username",
13+
Use: "users <username>",
14+
Args: cobra.ExactArgs(1),
15+
Short: "Create a alternate username",
16+
Long: "Create a alternate username",
17+
Aliases: []string{"user", "usr"},
1718
Run: func(cmd *cobra.Command, args []string) {
1819
username := args[0]
1920
configuration := config.LoadConfig()

cmd/delete/caches/caches.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ const deleteType = "caches"
1010

1111
func NewCachesCommand() *cobra.Command {
1212
cachesCmd := &cobra.Command{
13-
Use: "caches <ipAddress>",
14-
Args: cobra.ExactArgs(1),
15-
Short: "Delete a alternate cache",
16-
Long: "Delete a alternate cache",
13+
Use: "caches <ipAddress>",
14+
Args: cobra.ExactArgs(1),
15+
Short: "Delete a alternate cache",
16+
Long: "Delete a alternate cache",
17+
Aliases: []string{"cache"},
1718
Run: func(cmd *cobra.Command, args []string) {
1819
ipAddress := args[0]
1920
configuration := config.LoadConfig()

cmd/delete/delete.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import (
1010

1111
func NewDeleteCommand() *cobra.Command {
1212
deleteCmd := &cobra.Command{
13-
Use: "delete [command]",
14-
Short: "Delete alternate username, port number, password, and login cache information",
15-
Long: "Delete alternate username, port number, password, and login cache information",
13+
Use: "delete [command]",
14+
Short: "Delete alternate username, port number, password, and login cache information",
15+
Long: "Delete alternate username, port number, password, and login cache information",
16+
Aliases: []string{"del"},
1617
}
1718
deleteCmd.AddCommand(users.NewUsersCommand())
1819
deleteCmd.AddCommand(ports.NewPortsCommand())

cmd/delete/passwords/passwords.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ const deleteType = "passwords"
1010

1111
func NewPasswordsCommand() *cobra.Command {
1212
passwordsCmd := &cobra.Command{
13-
Use: "passwords <password>",
14-
Args: cobra.ExactArgs(1),
15-
Short: "Delete a alternate password",
16-
Long: "Delete a alternate password",
13+
Use: "passwords <password>",
14+
Args: cobra.ExactArgs(1),
15+
Short: "Delete a alternate password",
16+
Long: "Delete a alternate password",
17+
Aliases: []string{"password", "pass", "pwd"},
1718
Run: func(cmd *cobra.Command, args []string) {
1819
password := args[0]
1920
configuration := config.LoadConfig()

cmd/delete/ports/ports.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ const deleteType = "ports"
1010

1111
func NewPortsCommand() *cobra.Command {
1212
portsCmd := &cobra.Command{
13-
Use: "ports <port>",
14-
Args: cobra.ExactArgs(1),
15-
Short: "Delete a alternate port",
16-
Long: "Delete a alternate port",
13+
Use: "ports <port>",
14+
Args: cobra.ExactArgs(1),
15+
Short: "Delete a alternate port",
16+
Long: "Delete a alternate port",
17+
Aliases: []string{"port", "po"},
1718
Run: func(cmd *cobra.Command, args []string) {
1819
port := args[0]
1920
configuration := config.LoadConfig()

0 commit comments

Comments
 (0)