Skip to content

Commit 1a1283e

Browse files
committed
Add 'remove' command as an alias to 'uninstall'
1 parent 6a7bf94 commit 1a1283e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

news/8130.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add 'remove' command as an alias to 'uninstall'.

src/pip/_internal/cli/main_parser.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
ConfigOptionParser,
1010
UpdatingDefaultsHelpFormatter,
1111
)
12-
from pip._internal.commands import commands_dict, get_similar_commands
12+
from pip._internal.commands import (
13+
commands_aliases,
14+
commands_dict,
15+
get_similar_commands
16+
)
1317
from pip._internal.exceptions import CommandError
1418
from pip._internal.utils.misc import get_pip_version, get_prog
1519
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
@@ -83,7 +87,9 @@ def parse_command(args):
8387
# the subcommand name
8488
cmd_name = args_else[0]
8589

86-
if cmd_name not in commands_dict:
90+
if cmd_name in commands_aliases:
91+
cmd_name = commands_aliases[cmd_name]
92+
elif cmd_name not in commands_dict:
8793
guess = get_similar_commands(cmd_name)
8894

8995
msg = ['unknown command "{}"'.format(cmd_name)]

src/pip/_internal/commands/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
1818

1919
if MYPY_CHECK_RUNNING:
20-
from typing import Any
20+
from typing import Any, Dict
2121
from pip._internal.cli.base_command import Command
2222

2323

@@ -94,6 +94,8 @@
9494
)),
9595
]) # type: OrderedDict[str, CommandInfo]
9696

97+
command_aliases = {'remove': 'uninstall'} # type: Dict[str, str]
98+
9799

98100
def create_command(name, **kwargs):
99101
# type: (str, **Any) -> Command

0 commit comments

Comments
 (0)