Example #1
0
def _get_all_absolute_paths_from_history(command):
    counter = Counter()

    for line in get_valid_history_without_current(command):
        splitted = shell.split_command(line)

        for param in splitted[1:]:
            if param.startswith("/") or param.startswith("~"):
                if param.endswith("/"):
                    param = param[:-1]

                counter[param] += 1

    return (path for path, _ in counter.most_common(None))
Example #2
0
def _get_all_absolute_paths_from_history(command):
    counter = Counter()

    for line in get_valid_history_without_current(command):
        splitted = shell.split_command(line)

        for param in splitted[1:]:
            if param.startswith('/') or param.startswith('~'):
                if param.endswith('/'):
                    param = param[:-1]

                counter[param] += 1

    return (path for path, _ in counter.most_common(None))
Example #3
0
 def test_get_valid_history_without_current(self, script, result):
     command = Command(script=script)
     assert get_valid_history_without_current(command) == result
Example #4
0
 def test_get_valid_history_without_current(self, script, result):
     command = Command(script, "")
     assert get_valid_history_without_current(command) == result
def _get_used_executables(command):
    for script in get_valid_history_without_current(command):
        yield script.split(' ')[0]
Example #6
0
def _get_used_executables(command):
    for script in get_valid_history_without_current(command):
        yield script.split(' ')[0]
Example #7
0
 def test_get_valid_history_without_current(self, script):
     command = Command(script, '')
     assert script not in get_valid_history_without_current(command)
Example #8
0
def match(command):
    return len(
        get_close_matches(command.script,
                          get_valid_history_without_current(command)))
Example #9
0
def get_new_command(command):
    return get_closest(command.script,
                       get_valid_history_without_current(command))
Example #10
0
def get_new_command(command):
    return get_closest(command.script,
                       get_valid_history_without_current(command))
Example #11
0
def match(command):
    return len(get_close_matches(command.script,
                                 get_valid_history_without_current(command)))