Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ArgsCmd = &cobra.Command{ Use: "args", Short: "Print the SSH command for a host", Long: "Print the SSH command for a host", Run: func(cmd *cobra.Command, args []string) { filename := resolveFilename(cmd) if len(args) != 1 { log.Fatal("Please specify one host") } engine.Init(filename).Args(args[0]) }, }
ArgsCmd - Print the SSH command for a host.
View Source
var ConnectCmd = &cobra.Command{ Use: "to", Short: "Connect to a host", Long: "Connect to a host", Run: func(cmd *cobra.Command, args []string) { filename := resolveFilename(cmd) if len(args) != 1 { log.Fatal("Please specify one host") } engine.Init(filename).Connect(args[0]) }, }
ConnectCmd - Connect to a host.
View Source
var InitCmd = &cobra.Command{ Use: "init", Short: "Initialize a konnect.yml configuration file at the given directory.", Long: "Initialize a konnect.yml configuration file at the given directory.", Run: func(cmd *cobra.Command, args []string) { dir := "." if len(args) > 1 { log.Fatal("Too many args. Please specify a directory") } if len(args) == 1 { dir = args[0] } dir, _ = filepath.Abs(dir) localFilename := getDefaultConfig() filename := filepath.Join(dir, localFilename) if _, err := os.Stat(filename); err == nil { log.Fatalf("File %v already exists.\n", filename) } makeDefaultConfig(filename) }, }
InitCmd - Create configuration file.
View Source
var ListCmd = &cobra.Command{ Use: "ls", Short: "List all hosts", Long: "List all hosts", Run: func(cmd *cobra.Command, args []string) { filename := resolveFilename(cmd) if len(args) != 0 { log.Fatal("The list subcommand does not take any arguments") } engine.Init(filename).List() }, }
ListCmd - List all hosts from config file.
View Source
var RootCmd = &cobra.Command{ Use: "konnect", Short: "Connect to SSH hosts.", Long: "Define and connect to SSH hosts.", Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, PreRun: func(cmd *cobra.Command, args []string) { if version { fmt.Println(getVersion()) os.Exit(0) } if interactive { InteractivePrompt(cmd) os.Exit(0) } }, }
RootCmd - Entry point to the application.
View Source
var StatusCmd = &cobra.Command{ Use: "status", Short: "Check the status of one or more hosts", Long: "Check the status of one or more hosts", Run: func(cmd *cobra.Command, args []string) { filename := resolveFilename(cmd) konnect := engine.Init(filename) hosts := args if allHosts == true { hosts = konnect.GetHosts() } if allHosts == true && len(args) > 0 { log.Fatal("Cannot use --all with specific hosts") } if allHosts == false && len(args) == 0 { log.Fatal("Please specify one or more hosts") } hosts = removeDuplicates(hosts) konnect.CheckHosts(hosts) fmt.Printf("Testing connections for %v\n\n", strings.Join(hosts, ", ")) konnect.Status(hosts) }, }
StatusCmd - Check the status of one or more hosts.
View Source
var VersionCmd = &cobra.Command{ Use: "version", Short: "Show detailed version information", Long: "Show detailed version information", Run: func(cmd *cobra.Command, args []string) { fmt.Printf("Konnect - version %v\n", getVersion()) }, }
VersionCmd - Show detailed version information.
Functions ¶
func InteractivePrompt ¶
InteractivePrompt to connect to hosts.
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.