pee/project-manager/main.go

33 lines
687 B
Go
Raw Permalink Normal View History

2023-10-22 01:12:58 +05:30
package projectmanager
import (
2023-10-22 01:24:16 +05:30
projectconfig "github.com/xrehpicx/pee/config"
"github.com/xrehpicx/pee/controller"
2023-10-22 01:12:58 +05:30
"github.com/charmbracelet/log"
"github.com/spf13/cobra"
)
var RootCmd = &cobra.Command{
Use: "pee",
Args: cobra.ExactArgs(1),
2023-10-22 01:12:58 +05:30
Run: func(cmd *cobra.Command, args []string) {
ExecuteProjectEnv(args[0])
},
}
func ExecuteProjectEnv(projectName string) {
config, err := projectconfig.GetProjectConfig(projectName)
if err != nil {
log.Error(err)
return
}
err = controller.CreateTmuxSession(config)
if err != nil {
log.Error(err)
return
}
projectconfig.UpdateLastOpened(projectName)
2023-10-22 14:01:39 +05:30
log.Debug("Created tmux session", "name", config.SessionName)
2023-10-22 01:12:58 +05:30
}