joshmedeski / sesh

Smart session manager for the terminal
MIT License
410 stars 16 forks source link

sesh connect does not consider space in dir names #75

Closed ajaymahar closed 4 months ago

ajaymahar commented 4 months ago

What happened?

When I , I expected but _ happened! When I try to switch session with on of my zoxide path, (which have space in dir name). I expected to get into new session but sesh existed. I tried to replicate it manually below are the steps to reproduce the issue.

Step-1: create some dir with space in name Step-2: z into that dir so zoxide will have entry for it Step-3: try `sesh connect fails.

Example:

  1. Execute below cmd to get all the session list and zoxide

    sesh list -tz | fzf-tmux -p 55%,60% \                                      --no-sort --border-label ' Sessions ' --prompt '   ' \
    --header '   all[^a] |  tmux[^t] |  zoxide[^x] |  find[^f]' \
    --bind 'tab:down,btab:up' \
    --bind 'ctrl-a:change-prompt(  )+reload(sesh list)' \
    --bind 'ctrl-t:change-prompt(   )+reload(sesh list -t)' \
    --bind 'ctrl-x:change-prompt(   )+reload(sesh list -z)' \
    --bind 'ctrl-f:change-prompt(   )+reload(fd -H -d 2 -t d -E .Trash . ~)'
  2. Try to select any dir which have space in name for me it was, see Notes Workspace have space

    sesh connect ~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Notes Workspace

    Error: ➜ sesh connect ~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Notes Workspace 2024/02/24 10:16:20 unable to connect to "/Users/ajay/Library/Mobile": failed to add "/Users/ajay/Library/Mobile" to zoxide: exit status 1

Hack/Workaround (manually) I use single quote ' ' when i tried to connect with sesh and it worked. ➜ sesh connect '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Notes Workspace'

Version

sesh version 0.13.0

Relevant log output

Error: ➜ sesh connect ~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Notes Workspace 2024/02/24 10:16:20 unable to connect to "/Users/ajay/Library/Mobile": failed to add "/Users/ajay/Library/Mobile" to zoxide: exit status 1

Reviewed

joshmedeski commented 4 months ago

This is a limitation with sesh right now (doesn't support spaces in session names). Unfortunately it's not a quick fix, so I will have to dedicate some effort to it!

A lot of it has to do with parsing the tmux list.

ajaymahar commented 4 months ago

Sure, one more thing i observed when I use icons in my session and zoxide dir names, name return by fzf is with icon so if we do something like delete session with ^d tmux does not find session bcoz name contains the icon too. Highlighted here bcoz it might be similar issue like space.

joshmedeski commented 4 months ago

Since fzf only accepts strings then the script would have to be updated significantly to support features like that.

Let me know if you have any ideas, it's getting pretty complicated trying to add icon support.

joshmedeski commented 4 months ago

@ajaymahar I added space support for both session paths and names, download v0.14.0 of sesh and let me know if you have any issues.