Source

pip-patches / user-alias

# HG changeset patch
# Parent 17250062114b72ef018755f2f307e3598139c54a
add a --user alias for --install-opt=--user

diff --git a/pip/commands/install.py b/pip/commands/install.py
--- a/pip/commands/install.py
+++ b/pip/commands/install.py
@@ -130,6 +130,18 @@ class InstallCommand(Command):
             help="Extra global options to be supplied to the setup.py"
             "call before the install command")
 
+        def add_user_flag_callback(option, opt_str, value, parser):
+            if not hasattr(parser, 'install_options'):
+                parser.install_options = []
+            parser.install_options.append('--user')
+
+        self.parser.add_option(
+            '--user',
+            action='callback',
+            nargs=0,
+            callback=add_user_flag_callback,
+            help='Install to user-site')
+
     def _build_package_finder(self, options, index_urls):
         """
         Create a package finder appropriate to this install command.