mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 01:10:57 +01:00
add base completer
This commit is contained in:
parent
810d2035ba
commit
af2d81c919
2 changed files with 18 additions and 0 deletions
|
@ -1,11 +1,13 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
from xonsh.completers.base import complete_base
|
||||
from xonsh.completers.path import complete_path
|
||||
from xonsh.completers.dirs import complete_cd, complete_rmdir
|
||||
from xonsh.completers.python import complete_python, complete_import
|
||||
from xonsh.completers.commands import complete_skipper
|
||||
|
||||
completers = OrderedDict()
|
||||
completers['base'] = complete_base
|
||||
completers['skip'] = complete_skipper
|
||||
completers['cd'] = complete_cd
|
||||
completers['rmdir'] = complete_cd
|
||||
|
|
16
xonsh/completers/base.py
Normal file
16
xonsh/completers/base.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from collections import Sequence
|
||||
|
||||
from xonsh.completers.path import complete_path
|
||||
from xonsh.completers.python import complete_python
|
||||
from xonsh.completers.commands import complete_command
|
||||
|
||||
def complete_base(prefix, line, start, end, ctx):
|
||||
if line.strip() == '':
|
||||
out = (complete_python(prefix, line, start, end, ctx) |
|
||||
complete_command(prefix, line, start, end, ctx))
|
||||
paths = complete_path(prefix, line, start, end, ctx)
|
||||
return (out | paths[0]), paths[1]
|
||||
elif prefix == line:
|
||||
return (complete_python(prefix, line, start, end, ctx) |
|
||||
complete_command(prefix, line, start, end, ctx))
|
||||
return set()
|
Loading…
Add table
Reference in a new issue