From eb19707d1fddb74429f13d16dc64dc6f068526ff Mon Sep 17 00:00:00 2001 From: Saahil Bhavsar Date: Wed, 13 Nov 2024 00:41:47 +0530 Subject: [PATCH] Updates to version 0.1.1 (#22) * Updates README.md Signed-off-by: Saahil Bhavsar * Version 0.1.1 Signed-off-by: Saahil Bhavsar * Adds option to change port to the configure command (#21) Signed-off-by: Saahil Bhavsar --------- Signed-off-by: Saahil Bhavsar --- VERSION | 2 +- cli/cmd/configure.go | 32 ++++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 6c6aa7c..6da28dd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 \ No newline at end of file +0.1.1 \ No newline at end of file diff --git a/cli/cmd/configure.go b/cli/cmd/configure.go index 6134701..13443cb 100644 --- a/cli/cmd/configure.go +++ b/cli/cmd/configure.go @@ -23,8 +23,10 @@ var configureCmd = &cobra.Command{ fmt.Println("---Setup Initiated----") serverFlag, _ := cmd.Flags().GetString("server") + port, _ := cmd.Flags().GetString("port") keyFlag, _ := cmd.Flags().GetString("key") emailFlag, _ := cmd.Flags().GetString("email") + emailArgs := emailFlag userArgs := serverFlag @@ -80,6 +82,8 @@ var configureCmd = &cobra.Command{ if privateKeyAuth && privateKeyPath != "" { osCommand = exec.Command( "ssh", + "-p", + port, "-i", privateKeyPath, userArgs, @@ -89,6 +93,8 @@ var configureCmd = &cobra.Command{ } else { osCommand = exec.Command( "ssh", + "-p", + port, userArgs, "uname", "-o", @@ -117,6 +123,8 @@ var configureCmd = &cobra.Command{ if privateKeyAuth && privateKeyPath != "" { scpCommandScript = []string{ "scp", + "-P", + port, "-i", privateKeyPath, configPath, @@ -124,6 +132,8 @@ var configureCmd = &cobra.Command{ } sshCommandChmod = []string{ "ssh", + "-p", + port, "-i", privateKeyPath, userArgs, @@ -133,6 +143,8 @@ var configureCmd = &cobra.Command{ } sshCommandConfigure = []string{ "ssh", + "-p", + port, "-i", privateKeyPath, userArgs, @@ -144,11 +156,15 @@ var configureCmd = &cobra.Command{ } else { scpCommandScript = []string{ "scp", + "-P", + port, configPath, userArgs + ":" + serverConfigPath, } sshCommandChmod = []string{ "ssh", + "-p", + port, userArgs, "chmod", "+x", @@ -156,6 +172,8 @@ var configureCmd = &cobra.Command{ } sshCommandConfigure = []string{ "ssh", + "-p", + port, userArgs, serverConfigPath, emailArgs, @@ -223,7 +241,7 @@ var configureCmd = &cobra.Command{ var value string var description string - value = fmt.Sprintf("ssh %s", userArgs) + value = fmt.Sprintf("ssh -p %s %s", port, userArgs) fmt.Print("Enter an alias for this server: ") fmt.Scanln(&aliasName) @@ -249,9 +267,15 @@ func init() { rootCmd.AddCommand(configureCmd) configureCmd.Flags().StringP( - "server", "s", "", "The server you want to configure in") + "server", "s", "", "The server you want to configure in", + ) + configureCmd.Flags().StringP( + "email", "e", "", "The email you want to configure with", + ) configureCmd.Flags().StringP( - "email", "e", "", "The email you want to configure with") + "key", "i", "", "To choose if you want to use private key for setup", + ) configureCmd.Flags().StringP( - "key", "i", "", "To choose if you want to use private key for setup") + "port", "p", "22", "The port to connect to the server on", + ) }