aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2011-08-27 10:09:44 -0400
committerGravatar Jon Bernard <jbernard@tuxion.com> 2011-08-27 10:09:44 -0400
commit142a893a006d3226d8d4caa512c8fdfffd9acb31 (patch)
treecee07a8fd1dd525f279fb65cdc447c1a5fdec5ba
parent3fc687b73042b617b1df3d93266494f0da3dba50 (diff)
downloaddotfiles-142a893a006d3226d8d4caa512c8fdfffd9acb31.tar.gz
dotfiles-142a893a006d3226d8d4caa512c8fdfffd9acb31.tar.bz2
dotfiles-142a893a006d3226d8d4caa512c8fdfffd9acb31.zip
Fix CLI dispatch to work with previous refactoring
-rw-r--r--dotfiles/cli.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/dotfiles/cli.py b/dotfiles/cli.py
index 7b8ca59..2725c06 100644
--- a/dotfiles/cli.py
+++ b/dotfiles/cli.py
@@ -122,11 +122,28 @@ def main():
print "Error: An action is required. Type 'dotfiles -h' to see detailed usage information."
exit(-1)
- getattr(core.Dotfiles(location=opts.repo,
- prefix=opts.prefix,
- ignore=opts.ignore,
- externals=opts.externals,
- force=opts.force), opts.action)(files=args)
+ dotfiles = core.Dotfiles(home='~/', repo=opts.repo, prefix=opts.prefix,
+ ignore=opts.ignore, externals=opts.externals)
+
+ if opts.action in ['list', 'check']:
+ getattr(dotfiles, opts.action)()
+
+ elif opts.action in ['add', 'remove']:
+ getattr(dotfiles, opts.action)(args)
+
+ elif opts.action == 'sync':
+ dotfiles.sync(opts.force)
+
+ elif opts.action == 'move':
+ if len(args) > 1:
+ print "Error: Move cannot handle multiple targets."
+ exit(-1)
+ if opts.repo != args[0]:
+ dotfiles.move(args[0])
+
+ else:
+ print "Error: Something truly terrible has happened."
+ exit(-1)
def missing_default_repo():