diff options
Diffstat (limited to 'src/restore.c')
-rw-r--r-- | src/restore.c | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/src/restore.c b/src/restore.c index a18f906..426e803 100644 --- a/src/restore.c +++ b/src/restore.c @@ -129,44 +129,29 @@ int run_RESTORE(UserOpt *opt, Conf *conf) { cklist *from = list_make_new(); cklist *to = list_make_new(); int err_flag = 0; - if (strcmp(list_get(opt->args), "-p") == 0) { - if (list_next(opt->args)) { - if (program_exists(&db, list_get(opt->args))) { - if (restore_configs_exists(&db, conf, list_get(opt->args), from, to)) { - hLOG("Restoring links for %s...", list_get(opt->args)); - } - else { - err_flag = 1; - } + char *arg = list_get(opt->args); + if (strcmp(arg, "--all") != 0) { + if (program_exists(&db, arg)) { + if (restore_configs_exists(&db, conf, arg, from, to)) { + hLOG("Restoring links for %s...", arg); } else { - ERR("Program %s does not exist", list_get(opt->args)); err_flag = 1; } } else { - sERR("-p needs a program name"); + ERR("Program %s does not exist", arg); err_flag = 1; } } - else if (strcmp(list_get(opt->args), "all") == 0) { - if (!list_next(opt->args)) { - if (restore_all_exist(&db, conf, from, to)) { - hLOG("Restoring all links..."); - } - else { - err_flag = 1; - } + else { + if (restore_all_exist(&db, conf, from, to)) { + hLOG("Restoring all links..."); } else { - sERR("Wrong argument"); err_flag = 1; } } - else { - sERR("Wrong argument"); - err_flag = 1; - } close_DB(&db); int rc = -1; if (!err_flag) { @@ -181,7 +166,7 @@ int run_RESTORE(UserOpt *opt, Conf *conf) { } void print_RESTORE_help() { - ckhelp("ck restore -p PROGRAM_NAME"); - ckhelp("ck restore all"); + ckhelp("ck restore PROGRAM_NAME"); + ckhelp("ck restore --all"); report_help(); } |