@@ -50,7 +50,7 @@ func newShellCommand() *cobra.Command {
50
50
51
51
shellCmd .Flags ().String ("shell" , "" , "shell interpreter, e.g. /bin/bash" )
52
52
shellCmd .Flags ().String ("workdir" , "" , "working directory" )
53
- shellCmd .Flags ().BoolP ( "exit-session " , "e" , false , "exit a ssh session for the instance " )
53
+ shellCmd .Flags ().Bool ( "restart-ssh " , false , "restart the SSH connection " )
54
54
return shellCmd
55
55
}
56
56
@@ -83,11 +83,11 @@ func shellAction(cmd *cobra.Command, args []string) error {
83
83
return fmt .Errorf ("instance %q is stopped, run `limactl start %s` to start the instance" , instName , instName )
84
84
}
85
85
86
- exit , err := cmd .Flags ().GetBool ("exit-session " )
86
+ restart , err := cmd .Flags ().GetBool ("restart-ssh " )
87
87
if err != nil {
88
88
return err
89
89
}
90
- if exit {
90
+ if restart {
91
91
logrus .Infof ("Exiting ssh session for the instance %q" , instName )
92
92
93
93
sshConfig := & ssh.SSHConfig {
@@ -99,8 +99,6 @@ func shellAction(cmd *cobra.Command, args []string) error {
99
99
if err := ssh .ExitMaster (inst .Hostname , inst .SSHLocalPort , sshConfig ); err != nil {
100
100
return err
101
101
}
102
-
103
- return nil
104
102
}
105
103
106
104
// When workDir is explicitly set, the shell MUST have workDir as the cwd, or exit with an error.
0 commit comments