From 142a893a006d3226d8d4caa512c8fdfffd9acb31 Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Sat, 27 Aug 2011 10:09:44 -0400 Subject: Fix CLI dispatch to work with previous refactoring --- dotfiles/cli.py | 27 ++++++++++++++++++++++----- 1 file 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(): -- cgit v1.2.3