Revert "feat: Allow stopping smug session without specifying a project" (#86)

This reverts commit 6c4f6e067a.
master
Ivan 2 years ago committed by GitHub
parent 6c4f6e067a
commit c2d915d4e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,6 +68,13 @@ func main() {
userConfigDir := filepath.Join(ExpandPath("~/"), ".config/smug")
var configPath string
if options.Config != "" {
configPath = options.Config
} else {
configPath = filepath.Join(userConfigDir, options.Project+".yml")
}
var logger *log.Logger
if options.Debug {
logFile, err := os.Create(filepath.Join(userConfigDir, "smug.log"))
@ -83,20 +90,6 @@ func main() {
smug := Smug{tmux, commander}
context := CreateContext()
var configPath string
if options.Config != "" {
configPath = options.Config
} else if options.Project != "" {
configPath = filepath.Join(userConfigDir, options.Project+".yml")
} else {
s, err := tmux.CurrentSession()
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}
configPath = filepath.Join(userConfigDir, s+".yml")
}
switch options.Command {
case CommandStart:
if len(options.Windows) == 0 {

@ -181,14 +181,3 @@ func (tmux Tmux) ListPanes(target string) ([]TmuxPane, error) {
return panes, nil
}
func (tmux Tmux) CurrentSession() (string, error) {
cmd := exec.Command("tmux", "display-message", "-p", "#S")
sessionName, err := tmux.commander.Exec(cmd)
if err != nil {
return sessionName, err
}
return sessionName, nil
}

Loading…
Cancel
Save