File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change
1
+ Add 'remove' command as an alias to 'uninstall' .
Original file line number Diff line number Diff line change 9
9
ConfigOptionParser ,
10
10
UpdatingDefaultsHelpFormatter ,
11
11
)
12
- from pip ._internal .commands import commands_dict , get_similar_commands
12
+ from pip ._internal .commands import (
13
+ command_aliases ,
14
+ commands_dict ,
15
+ get_similar_commands ,
16
+ )
13
17
from pip ._internal .exceptions import CommandError
14
18
from pip ._internal .utils .misc import get_pip_version , get_prog
15
19
from pip ._internal .utils .typing import MYPY_CHECK_RUNNING
@@ -81,9 +85,11 @@ def parse_command(args):
81
85
sys .exit ()
82
86
83
87
# the subcommand name
84
- cmd_name = args_else [0 ]
88
+ cmd_alias = cmd_name = args_else [0 ]
85
89
86
- if cmd_name not in commands_dict :
90
+ if cmd_alias in command_aliases :
91
+ cmd_name = command_aliases [cmd_alias ]
92
+ elif cmd_name not in commands_dict :
87
93
guess = get_similar_commands (cmd_name )
88
94
89
95
msg = ['unknown command "{}"' .format (cmd_name )]
@@ -94,6 +100,6 @@ def parse_command(args):
94
100
95
101
# all the args without the subcommand
96
102
cmd_args = args [:]
97
- cmd_args .remove (cmd_name )
103
+ cmd_args .remove (cmd_alias )
98
104
99
105
return cmd_name , cmd_args
Original file line number Diff line number Diff line change 17
17
from pip ._internal .utils .typing import MYPY_CHECK_RUNNING
18
18
19
19
if MYPY_CHECK_RUNNING :
20
- from typing import Any
20
+ from typing import Any , Dict
21
21
from pip ._internal .cli .base_command import Command
22
22
23
23
94
94
)),
95
95
]) # type: OrderedDict[str, CommandInfo]
96
96
97
+ command_aliases = {'remove' : 'uninstall' } # type: Dict[str, str]
98
+
97
99
98
100
def create_command (name , ** kwargs ):
99
101
# type: (str, **Any) -> Command
You can’t perform that action at this time.
0 commit comments