Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/devlup-labs/spok
Browse files Browse the repository at this point in the history
  • Loading branch information
SaahilNotSahil committed Nov 12, 2024
2 parents bb73267 + eb19707 commit 24caa47
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1.1
32 changes: 28 additions & 4 deletions cli/cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -80,6 +82,8 @@ var configureCmd = &cobra.Command{
if privateKeyAuth && privateKeyPath != "" {
osCommand = exec.Command(
"ssh",
"-p",
port,
"-i",
privateKeyPath,
userArgs,
Expand All @@ -89,6 +93,8 @@ var configureCmd = &cobra.Command{
} else {
osCommand = exec.Command(
"ssh",
"-p",
port,
userArgs,
"uname",
"-o",
Expand Down Expand Up @@ -117,13 +123,17 @@ var configureCmd = &cobra.Command{
if privateKeyAuth && privateKeyPath != "" {
scpCommandScript = []string{
"scp",
"-P",
port,
"-i",
privateKeyPath,
configPath,
userArgs + ":" + serverConfigPath,
}
sshCommandChmod = []string{
"ssh",
"-p",
port,
"-i",
privateKeyPath,
userArgs,
Expand All @@ -133,6 +143,8 @@ var configureCmd = &cobra.Command{
}
sshCommandConfigure = []string{
"ssh",
"-p",
port,
"-i",
privateKeyPath,
userArgs,
Expand All @@ -144,18 +156,24 @@ var configureCmd = &cobra.Command{
} else {
scpCommandScript = []string{
"scp",
"-P",
port,
configPath,
userArgs + ":" + serverConfigPath,
}
sshCommandChmod = []string{
"ssh",
"-p",
port,
userArgs,
"chmod",
"+x",
serverConfigPath,
}
sshCommandConfigure = []string{
"ssh",
"-p",
port,
userArgs,
serverConfigPath,
emailArgs,
Expand Down Expand Up @@ -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)
Expand All @@ -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",
)
}

0 comments on commit 24caa47

Please sign in to comment.