Commit e1997d75 authored by adam j hartz's avatar adam j hartz

make suggestions use the function from the module

parent 5fea45ba
......@@ -44,10 +44,9 @@ from takoshell.environ import Env, default_env, locate_binary
from takoshell.jobs import add_job, wait_for_active_job
from takoshell.proc import (ProcProxy, SimpleProcProxy,
CompletedCommand, HiddenCompletedCommand)
from takoshell.tools import (
suggest_commands, expandvars, CommandsCache, globpath, TakoError,
TakoCalledProcessError
)
import takoshell.tools
from takoshell.tools import TakoError, TakoCalledProcessError
BUILTINS_LOADED = False
AT_EXIT_SIGNALS = (signal.SIGABRT, signal.SIGFPE, signal.SIGILL, signal.SIGSEGV,
......@@ -81,7 +80,7 @@ def resetting_signal_handle(sig, f):
def expand_path(s):
"""Takes a string path and expands ~ to home and environment vars."""
if builtins.__tako_env__['TAKO_SETTINGS'].expand_env_vars:
s = expandvars(s)
s = takoshell.tools.expandvars(s)
return os.path.expanduser(s)
......@@ -129,7 +128,8 @@ def globsearch(s):
env = builtins.__tako_env__
csc = env['TAKO_SETTINGS'].CASE_SENSITIVE_COMPLETIONS
test_strings = braceexpand(s)
return sum((list(globpath(s, ignore_case=(not csc), return_empty=True)) for s in test_strings), [])
return sum((list(takoshell.tools.globpath(s, ignore_case=(not csc), return_empty=True))
for s in test_strings), [])
def pathsearch(func, s, pymode=False):
......@@ -528,9 +528,9 @@ def run_subproc(cmds, captured=False):
except FileNotFoundError:
cmd = aliased_cmd[0]
e = 'tako: subprocess mode: command not found: {0}'.format(cmd)
sug = suggest_commands(cmd, env, aliases) or ''
sug = takoshell.tools.suggest_commands(cmd, env, aliases) or ''
if len(sug.strip()) > 0:
e += '\n' + suggest_commands(cmd, env, aliases)
e += '\n' + sug
raise TakoError(e)
fire_event('pre_command', ocmd)
procs.append(proc)
......@@ -698,7 +698,7 @@ def load_builtins(execer=None, login=False, ctx=None):
builtins.__tako_pathsearch__ = pathsearch
builtins.__tako_globsearch__ = globsearch
builtins.__tako_regexsearch__ = regexsearch
builtins.__tako_glob__ = globpath
builtins.__tako_glob__ = takoshell.tools.globpath
builtins.__tako_expand_path__ = expand_path
builtins.__tako_exit__ = False
builtins.__tako_stdout_uncaptured__ = None
......@@ -715,7 +715,7 @@ def load_builtins(execer=None, login=False, ctx=None):
builtins.__tako_subproc_captured_hiddenobject__ = subproc_captured_hiddenobject
builtins.__tako_subproc_uncaptured__ = subproc_uncaptured
builtins.__tako_execer__ = execer
builtins.__tako_commands_cache__ = CommandsCache()
builtins.__tako_commands_cache__ = takoshell.tools.CommandsCache()
builtins.__tako_all_jobs__ = {}
builtins.__tako_ensure_list_of_strs__ = ensure_list_of_strs
builtins.__tako_list_of_strs_or_callables__ = list_of_strs_or_callables
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment