Skip to content

Commit

Permalink
Long term name for split_line is argcomplete.lexers.split_line
Browse files Browse the repository at this point in the history
  • Loading branch information
kislyuk committed Mar 21, 2023
1 parent 83f7e21 commit 874350d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion argcomplete/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .exceptions import ArgcompleteException
from .finders import CompletionFinder, ExclusiveCompletionFinder, safe_actions
from .io import debug, mute_stderr, warn
from .lexers import _split_line as split_line
from .lexers import split_line
from .shell_integration import shellcode

autocomplete = CompletionFinder()
Expand Down
6 changes: 3 additions & 3 deletions argcomplete/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from . import io as _io
from .completers import ChoicesCompleter, FilesCompleter, SuppressCompleter
from .io import debug, mute_stderr
from .lexers import _split_line
from .lexers import split_line
from .packages._argparse import IntrospectiveArgumentParser, action_is_greedy, action_is_open, action_is_satisfied

safe_actions = {
Expand Down Expand Up @@ -148,7 +148,7 @@ def __call__(
comp_line = os.environ["COMP_LINE"]
comp_point = int(os.environ["COMP_POINT"])

cword_prequote, cword_prefix, cword_suffix, comp_words, last_wordbreak_pos = _split_line(comp_line, comp_point)
cword_prequote, cword_prefix, cword_suffix, comp_words, last_wordbreak_pos = split_line(comp_line, comp_point)

# _ARGCOMPLETE is set by the shell script to tell us where comp_words
# should start, based on what we're completing.
Expand Down Expand Up @@ -549,7 +549,7 @@ def rl_complete(self, text, state):
result = input("prompt> ")
"""
if state == 0:
cword_prequote, cword_prefix, cword_suffix, comp_words, first_colon_pos = _split_line(text)
cword_prequote, cword_prefix, cword_suffix, comp_words, first_colon_pos = split_line(text)
comp_words.insert(0, sys.argv[0])
matches = self._get_completions(comp_words, cword_prefix, cword_prequote, first_colon_pos)
self._rl_matches = [text + match[len(cword_prefix) :] for match in matches]
Expand Down
2 changes: 1 addition & 1 deletion argcomplete/lexers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .packages import _shlex


def _split_line(line, point=None):
def split_line(line, point=None):
if point is None:
point = len(line)
line = line[:point]
Expand Down
9 changes: 4 additions & 5 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
_check_module,
autocomplete,
shellcode,
split_line,
warn,
)
from argcomplete.completers import DirectoriesCompleter, FilesCompleter, SuppressCompleter # noqa: E402
from argcomplete.lexers import _split_line # noqa: E402
from argcomplete.lexers import split_line # noqa: E402

IFS = "\013"
COMP_WORDBREAKS = " \t\n\"'><=;|&(:"
Expand Down Expand Up @@ -836,7 +835,7 @@ def tearDown(self):
pass

def run_completer(self, parser, completer, command, point=None, **kwargs):
cword_prequote, cword_prefix, cword_suffix, comp_words, first_colon_pos = _split_line(command)
cword_prequote, cword_prefix, cword_suffix, comp_words, first_colon_pos = split_line(command)

completions = completer._get_completions(comp_words, cword_prefix, cword_prequote, first_colon_pos)

Expand Down Expand Up @@ -948,10 +947,10 @@ def tearDown(self):
os.environ = self._os_environ

def prefix(self, line):
return _split_line(line)[1]
return split_line(line)[1]

def wordbreak(self, line):
return _split_line(line)[4]
return split_line(line)[4]

def test_simple(self):
self.assertEqual(self.prefix("a b c"), "c")
Expand Down

0 comments on commit 874350d

Please sign in to comment.