Permalink
Browse files

legit git aliases

  • Loading branch information...
1 parent 69340b6 commit 2fb1284bd9c8c48d22b1e9c9eca93735047f7dab @kennethreitz committed Mar 25, 2012
Showing with 25 additions and 1 deletion.
  1. +25 −1 legit/cli.py
View
@@ -367,6 +367,29 @@ def cmd_settings(args):
sys.exit()
+def cmd_install(args):
+ """Installs legit git aliases."""
+
+ aliases = {
+ 'branches': '\'!legit branches\'',
+ 'graft': '\'!legit graft "$@"\'',
+ 'harvest': '\'!legit harvest "$@"\'',
+ 'publish': '\'!legit publish "$@"\'',
+ 'unpublish': '\'!legit unpublish "$@"\'',
+ 'sprout': '\'!legit sprout "$@"\'',
+ 'sync': '\'!legit sync "$@"\'',
+ 'switch': '\'!legit switch "$@"\'',
+ }
+
+ print 'The following git aliases have been installed:\n'
+
+ for (ak, av) in aliases.items():
+ os.system('git config --global --replace-all alias.{0} {1}'.format(ak, av))
+ print columns(['', 1], [colored.yellow('git ' + ak), 14], [av, None])
+
+ sys.exit()
+
+
def cmd_help(args):
"""Display help for individual commands."""
command = args.get(0)
@@ -481,7 +504,8 @@ def handle_abort(aborted):
unpublish=cmd_unpublish,
branches=cmd_branches,
settings=cmd_settings,
- help=cmd_help
+ help=cmd_help,
+ install=cmd_install
)
short_map = dict(

0 comments on commit 2fb1284

Please sign in to comment.