Skip to content

Commit

Permalink
feat: Make stop working without session name
Browse files Browse the repository at this point in the history
  • Loading branch information
ivaaaan authored May 30, 2022
1 parent c2d915d commit d053a9d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ 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"))
Expand All @@ -90,6 +83,20 @@ 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.SessionName()
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 {
Expand Down

0 comments on commit d053a9d

Please sign in to comment.