Exemplo n.º 1
0
 def _add_cdpaths(self, paths, prefix):
     """Completes current prefix using CDPATH"""
     env = builtins.__xonsh_env__
     for cdp in env.get("CDPATH", []):
         for s in iglobpath(os.path.join(cdp, prefix) + '*'):
             if os.path.isdir(s):
                 paths.add(os.path.basename(s))
Exemplo n.º 2
0
 def _add_cdpaths(self, paths, prefix):
     """Completes current prefix using CDPATH"""
     env = builtins.__xonsh_env__
     for cdp in env.get("CDPATH", []):
         for s in iglobpath(os.path.join(cdp, prefix) + '*'):
             if os.path.isdir(s):
                 paths.add(os.path.basename(s))
Exemplo n.º 3
0
 def _add_cdpaths(self, paths, prefix):
     """Completes current prefix using CDPATH"""
     csc = get_env('CASE_SENSITIVE_COMPLETIONS', True)
     for cdp in get_env("CDPATH", []):
         test_glob = os.path.join(cdp, prefix) + '*'
         for s in iglobpath(test_glob, ignore_case=(not csc)):
             if os.path.isdir(s):
                 paths.add(os.path.basename(s))
Exemplo n.º 4
0
 def _add_cdpaths(self, paths, prefix):
     """Completes current prefix using CDPATH"""
     csc = get_env('CASE_SENSITIVE_COMPLETIONS', True)
     for cdp in get_env("CDPATH", []):
         test_glob = os.path.join(cdp, prefix) + '*'
         for s in iglobpath(test_glob, ignore_case=(not csc)):
             if os.path.isdir(s):
                 paths.add(os.path.basename(s))
Exemplo n.º 5
0
 def _add_cdpaths(self, paths, prefix):
     """Completes current prefix using CDPATH"""
     env = builtins.__xonsh_env__
     csc = env.get('CASE_SENSITIVE_COMPLETIONS')
     for cdp in env.get('CDPATH'):
         test_glob = os.path.join(builtins.__xonsh_expand_path__(cdp), prefix) + '*'
         for s in iglobpath(test_glob, ignore_case=(not csc)):
             if os.path.isdir(s):
                 paths.add(os.path.basename(s))
Exemplo n.º 6
0
 def path_complete(self, prefix, start, end, cdpath=False):
     """Completes based on a path name."""
     tilde = '~'
     paths = set()
     csc = builtins.__xonsh_env__.get('CASE_SENSITIVE_COMPLETIONS')
     for s in iglobpath(prefix + '*', ignore_case=(not csc)):
         paths.add(s)
     if tilde in prefix:
         home = os.path.expanduser(tilde)
         paths = {s.replace(home, tilde) for s in paths}
     if cdpath:
         self._add_cdpaths(paths, prefix)
     paths = self._quote_paths({_normpath(s) for s in paths}, start, end)
     self._add_env(paths, prefix)
     self._add_dots(paths, prefix)
     return paths
Exemplo n.º 7
0
 def path_complete(self, prefix):
     """Completes based on a path name."""
     space = ' '  # intern some strings for faster appending
     slash = '/'
     tilde = '~'
     paths = set()
     if prefix.startswith("'") or prefix.startswith('"'):
         prefix = prefix[1:]
     for s in iglobpath(prefix + '*'):
         if space in s:
             s = repr(s + (slash if os.path.isdir(s) else ''))
         else:
             s = s + (slash if os.path.isdir(s) else space)
         paths.add(s)
     if tilde in prefix:
         home = os.path.expanduser(tilde)
         paths = {s.replace(home, tilde) for s in paths}
     return paths
Exemplo n.º 8
0
 def path_complete(self, prefix):
     """Completes based on a path name."""
     space = ' '  # intern some strings for faster appending
     slash = '/'
     tilde = '~'
     paths = set()
     if prefix.startswith("'") or prefix.startswith('"'):
         prefix = prefix[1:]
     for s in iglobpath(prefix + '*'):
         if space in s:
             s = repr(s + (slash if os.path.isdir(s) else ''))
         else:
             s = s + (slash if os.path.isdir(s) else space)
         paths.add(s)
     if tilde in prefix:
         home = os.path.expanduser(tilde)
         paths = {s.replace(home, tilde) for s in paths}
     self._add_env(paths, prefix)
     self._add_dots(paths, prefix)
     return paths
Exemplo n.º 9
0
 def path_complete(self, prefix, cdpath=False):
     """Completes based on a path name."""
     space = ' '  # intern some strings for faster appending
     slash = '/'
     tilde = '~'
     paths = set()
     csc = builtins.__xonsh_env__.get('CASE_SENSITIVE_COMPLETIONS')
     if prefix.startswith("'") or prefix.startswith('"'):
         prefix = prefix[1:]
     for s in iglobpath(prefix + '*', ignore_case=(not csc)):
         if space in s:
             s = repr(s + (slash if os.path.isdir(s) else ''))
         else:
             s = s + (slash if os.path.isdir(s) else space)
         paths.add(s)
     if tilde in prefix:
         home = os.path.expanduser(tilde)
         paths = {s.replace(home, tilde) for s in paths}
     self._add_env(paths, prefix)
     self._add_dots(paths, prefix)
     if cdpath:
         self._add_cdpaths(paths, prefix)
     return {_normpath(s) for s in paths}
Exemplo n.º 10
0
 def path_complete(self, prefix, cdpath=False):
     """Completes based on a path name."""
     space = ' '  # intern some strings for faster appending
     slash = '/'
     tilde = '~'
     paths = set()
     csc = builtins.__xonsh_env__.get('CASE_SENSITIVE_COMPLETIONS')
     if prefix.startswith("'") or prefix.startswith('"'):
         prefix = prefix[1:]
     for s in iglobpath(prefix + '*', ignore_case=(not csc)):
         if space in s:
             s = repr(s + (slash if os.path.isdir(s) else ''))
         else:
             s = s + (slash if os.path.isdir(s) else space)
         paths.add(s)
     if tilde in prefix:
         home = os.path.expanduser(tilde)
         paths = {s.replace(home, tilde) for s in paths}
     self._add_env(paths, prefix)
     self._add_dots(paths, prefix)
     if cdpath:
         self._add_cdpaths(paths, prefix)
     return {_normpath(s) for s in paths}