Skip to content

Commit

Permalink
feat: allow path to include trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmedeski committed May 16, 2024
1 parent 822a7bc commit 72f8441
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tmux/tmux.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ func execTmuxp(name string, command string) error {
return nil
}

func removeTrailingSlash(path string) string {
return strings.TrimRight(path, "/")
}

func getStartupScript(sessionPath string, config *config.Config) string {
for _, sessionConfig := range config.SessionConfigs {
// TODO: get working with /* again
scriptFullPath := dir.FullPath(sessionConfig.Path)
scriptFullPath := removeTrailingSlash(dir.FullPath(sessionConfig.Path))
match, _ := filepath.Match(scriptFullPath, sessionPath)
if match {
return sessionConfig.StartupScript
Expand All @@ -160,7 +164,7 @@ func getStartupScript(sessionPath string, config *config.Config) string {

func getStartupCommand(sessionPath string, config *config.Config) string {
for _, sessionConfig := range config.SessionConfigs {
scriptFullPath := dir.FullPath(sessionConfig.Path)
scriptFullPath := removeTrailingSlash(dir.FullPath(sessionConfig.Path))
match, _ := filepath.Match(scriptFullPath, sessionPath)
if match {
return sessionConfig.StartupCommand
Expand Down

0 comments on commit 72f8441

Please sign in to comment.