Fix session name to accept one argument #30

tony opened this Issue Dec 4, 2013 · 5 comments


2 participants

tony commented Dec 4, 2013

re #27

The freeze help message suggests it supports to freeze several sessions.

(tmuxp) tmuxp (master) ✗ tmuxp freeze -h
usage: tmuxp freeze [-h] [-L socket-name] [-S socket-path] [-y]
                    session_name [session_name ...]

But the result I got is not as expected.

(tmuxp) tmuxp (master) ✗ tmuxp freeze 0 1 3
args is Namespace(answer_yes=None, callback=<function command_freeze at 0x9036b8c>, colors=None, session_name=['0', '1', '3'], socket_name=None, socket_path=None)
session name are ['0', '1', '3']
Traceback (most recent call last):
  File "/home/maomao/.virtualenvs/tmuxp/bin/tmuxp", line 9, in <module>
    load_entry_point('tmuxp==0.1.0rc4', 'console_scripts', 'tmuxp')()
  File "/home/maomao/workspace/tmuxp/tmuxp/", line 958, in main
  File "/home/maomao/workspace/tmuxp/tmuxp/", line 335, in command_freeze
    'session_name': ctext
  File "/home/maomao/workspace/tmuxp/tmuxp/", line 159, in findWhere
    return self.where(attrs)[0] or None
IndexError: list index out of range

I can confirm that the valid session names are 0 1 3 in my case.

(tmuxp) tmuxp (master) ✗ tmux list-sessions 
0: 2 windows (created Tue Dec  3 16:01:57 2013) [213x54] (attached)
1: 1 windows (created Wed Dec  4 10:50:35 2013) [213x54]
3: 1 windows (created Wed Dec  4 20:47:53 2013) [80x23]

Currently, arguments are being accepting multiple words and concatenating them by spaces so users don't have to escape spaces in session names.

This will require updating autocomplete to add a \ for spaces in session names.


The autocomplete seems to escape all special characters in session name, not only spaces.

I just try session names like test-1, test_1, and it gives me test\-1, test\_1.

Is this behavior by design?


Then it's by design.

And the About tmux page is really helpful!


tony commented Dec 5, 2013


This was a midway update experimenting with how to fix escaping on bash completion.

Previously, argparse appeared to accept multiple arguments. In practice, it concatenated unescaped spaces into a full session name.

Now, argparse accepts one argument, but what about argcomplete (our bash completer) where there is special symbols and spaces in the name?

Currently, the solution to this problem is going to require changes to argcomplete, the situation is a bit more complicated because it involves escaping for both zsh and bash, argcomplete's zsh and bash script, and argcomplete's way of returning the completions, and tmux allows many special chars for session names.


tony commented Dec 5, 2013

This is indeed a larger issue @leechannl. I moved the recent work to a branch in

stale bot commented Nov 12, 2017

This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.

This bot is used to handle issues where the issue hasn't been discussed or
has gone out of date. If an issue isn't resolved and handled in a certain
period of time, it may be closed. If you would like your issue re-opened,
please create a fresh issue with the latest, up to date information and
mention this issue in it.

@stale stale bot added the stale label Nov 12, 2017

@stale stale bot closed this Nov 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment