Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't repair apt-get command #881

Open
thiswillbeyourgithub opened this issue Jan 24, 2019 · 1 comment
Open

Doesn't repair apt-get command #881

thiswillbeyourgithub opened this issue Jan 24, 2019 · 1 comment

Comments

@thiswillbeyourgithub
Copy link

The Fuck 3.28 using Python 3.6.7 and ZSH 5.4.2
Ubuntu 18.04 LTS

How to reproduce the bug:

type apt-get insatll test which is a wrong command ("insatll" insteaf of install)
returns E: Invalid operation insatl
type fuck
returns a previous apt-get command : sudo apt-get install redshift [enter/↑/↓/ctrl+c]
what should happen is a correction of insatll into install, as well as for at-get apt-gt etc

@djh82
Copy link
Contributor

djh82 commented Jan 2, 2020

This occurs because the help content of 'apt-get' now looks like the help content for 'apt' and so when the apt_invalid_operation rule tries to parse it to find the appropriate replacement, it fails.

I guess we could update _parse_apt_operations in apt_invalid_operations.py to be:

def _parse_apt_operations(help_text_lines):
    is_commands_list = False
    for line in help_text_lines:
        line = line.decode().strip()
        if is_commands_list and line:
            yield line.split()[0]
        elif line.startswith('Basic commands:') \
                or line.startswith('Most used commands:') \
                or line.startswith('Commands:'):
            is_commands_list = True

and then to remove _parse_apt_get_and_cache_operations entirely?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants