mirror of https://github.com/xrehpicx/pee.git
feat: added kill session command
This commit is contained in:
parent
6a4ac440b0
commit
0f3dfb20cc
|
@ -217,3 +217,12 @@ func createWindow(config *projectconfig.Configuration, sessionName string, index
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func KillTmuxSession(sessionName string) error {
|
||||||
|
killSessionCmd := exec.Command("tmux", "kill-session", "-t", sessionName)
|
||||||
|
if err := killSessionCmd.Run(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
log.Debug("Ran command", "command", killSessionCmd.String())
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,24 @@ var RootCmd = &cobra.Command{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var KillTmuxSessionCmd = &cobra.Command{
|
||||||
|
Use: "kill",
|
||||||
|
Args: cobra.ExactArgs(1),
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
sessionName := args[0]
|
||||||
|
err := controller.KillTmuxSession(sessionName)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Debug("Killed tmux session", "name", sessionName)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RootCmd.AddCommand(KillTmuxSessionCmd)
|
||||||
|
}
|
||||||
|
|
||||||
func ExecuteProjectEnv(projectName string) {
|
func ExecuteProjectEnv(projectName string) {
|
||||||
config, err := projectconfig.GetProjectConfig(projectName)
|
config, err := projectconfig.GetProjectConfig(projectName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue