Skip to content

Commit 1651012

Browse files
committed
use argcomplete, switch bash, zsh and tcsh scripts
1 parent 888549d commit 1651012

File tree

5 files changed

+19
-25
lines changed

5 files changed

+19
-25
lines changed

doc/quickstart.rst

+5-12
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,24 @@ This creates your tmuxp session.
4343
Bash completion
4444
"""""""""""""""
4545

46-
.. note::
47-
48-
Parts of the zsh, bash and tcsh completion and these docs are based on
49-
`aws cli`_.
50-
51-
For bash:
46+
For bash, ``.bashrc``:
5247

5348
.. code-block:: bash
5449
55-
$ complete -C tmuxp.bash tmuxp
50+
$ source tmuxp.bash
5651
57-
For tcsh:
52+
For tcsh, ``.tcshrc``:
5853

5954
.. code-block:: bash
6055
61-
$ complete tmuxp 'p/*/`tmuxp.bash`/'
56+
$ complete tmuxp 'p/*/`tmuxp.tcsh`/'
6257
63-
For zsh:
58+
For zsh, ``.zshrc``:
6459

6560
.. code-block:: bash
6661
6762
$ source tmuxp.zsh
6863
69-
.. _aws cli: https://github.com/aws/aws-cli
70-
7164
Python ORM + AL
7265
---------------
7366

pkg/tmuxp.bash

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf8 - *-
1+
#!/usr/bin/env bash
32

4-
import os
5-
from tmuxp import cli
6-
7-
if __name__ == '__main__':
8-
9-
cline = os.environ.get('COMP_LINE') or os.environ.get('COMMAND_LINE') or ''
10-
cpoint = int(os.environ.get('COMP_POINT') or len(cline))
11-
12-
cli.complete(cline, cpoint)
3+
eval "$(register-python-argcomplete tmuxp)"

pkg/tmuxp.tcsh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# testing tcsh from @redstreet's argcopmlete issue
4+
# https://github.com/kislyuk/argcomplete/issues/49
5+
export IFS=''
6+
export COMP_LINE=${COMMAND_LINE}
7+
export COMP_WORDBREAKS=
8+
export COMP_POINT=${#COMMAND_LINE}
9+
export _ARGCOMPLETE=1
10+
tmuxp 8>&1 9>&2 1>/dev/null 2>/dev/null

pkg/tmuxp.zsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ _bash_complete() {
6363
return ret
6464
}
6565

66-
complete -C tmuxp.bash tmuxp
66+
eval "$(register-python-argcomplete tmuxp)"

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def requirements(f):
4545
packages=['tmuxp', 'tmuxp.testsuite'],
4646
include_package_data=True,
4747
install_requires=requirements('requirements.pip'),
48-
scripts=['pkg/tmuxp.bash', 'pkg/tmuxp.zsh'],
48+
scripts=['pkg/tmuxp.bash', 'pkg/tmuxp.zsh', 'pkg/tmuxp.tcsh'],
4949
entry_points=dict(console_scripts=['tmuxp=tmuxp:main']),
5050
classifiers=[
5151
'Development Status :: 3 - Alpha',

0 commit comments

Comments
 (0)