Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConnectDeleteCmd = &cli.Command{ Name: "delete", Usage: "Delete connection alias", Description: "Delete a given connection alias.", Arguments: []cli.Argument{ &cli.StringArg{ Name: "alias", Usage: "The alias to delete", Required: true, }, }, MaxArgs: cli.NoArgs, Run: func(ctx context.Context, cmd *cli.Command) error { alias := cmd.GetStringArg("alias") if cmd.ConfigFile.FileUsed() == "" { return fmt.Errorf("No configuration file has been used.") } cmd.ConfigFile.DeleteKey("client.connection." + alias) if err := cmd.ConfigFile.Save(); err != nil { return fmt.Errorf("Failed to save config file: %v", err) } fmt.Printf("Successfully deleted connection '%s'.\n", alias) return nil }, }
View Source
var ConnectListCmd = &cli.Command{ Name: "list", Usage: "List the known connections", Description: "Lists all the known connections stored in the local config.", MaxArgs: cli.NoArgs, Run: func(ctx context.Context, cmd *cli.Command) error { connections := cmd.ConfigFile.GetKeys("client.connection") if len(connections) == 0 { fmt.Println("No connections found.") return nil } data := [][]string{} data = append(data, []string{"Alias", "Server"}) for _, alias := range connections { server, _ := cmd.ConfigFile.GetValue(fmt.Sprintf("client.connection.%s.server", alias)) serverStr, _ := server.(string) data = append(data, []string{alias, serverStr}) } util.PrintTable(data) return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.