File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ Here you can find the recent changes to tmuxp.
662013-10-16
77----------
88
9+ - [cli] bash autocomplete
910- [docs] New page on :ref: `orm_al `.
1011- [docs] Updates to :ref: `about_tmux ` page.
1112- [docs] add vim modeline for rst to bottom of this page
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ # -*- coding: utf8 - *-
3+
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 )
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ def requirements(f):
4444 packages = ['tmuxp' , 'tmuxp.testsuite' ],
4545 include_package_data = True ,
4646 install_requires = requirements ('requirements.pip' ),
47+ scripts = ['pkg/tmuxp.bash' ],
4748 entry_points = dict (console_scripts = ['tmuxp=tmuxp:main' ]),
4849 classifiers = [
4950 'Development Status :: 3 - Alpha' ,
Original file line number Diff line number Diff line change @@ -197,3 +197,18 @@ def main():
197197 logger .error ('%s not found.' % configfile )
198198 else :
199199 parser .print_help ()
200+
201+
202+ def complete (cline , cpoint ):
203+
204+ config_dir = os .path .expanduser ('~/.tmuxp/' )
205+ cwd_dir = os .getcwd () + '/'
206+
207+ commands = []
208+ commands += config .in_dir (config_dir )
209+ commands += config .in_cwd ()
210+
211+ ctext = cline .replace ('tmuxp ' , '' )
212+ commands = [c for c in commands if ctext in c ]
213+
214+ print (' \n ' .join (commands ))
You can’t perform that action at this time.
0 commit comments