Skip to content

Commit

Permalink
Merge pull request #89 from aschnell/master
Browse files Browse the repository at this point in the history
- do initialisation with declaration
  • Loading branch information
aschnell committed Jun 6, 2014
2 parents 74500d0 + d4e45e2 commit 0b20a20
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions client/snapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ struct Cmd
const bool needs_snapper;
};

list<Cmd> cmds;

GetOpts getopts;

bool quiet = false;
Expand Down Expand Up @@ -1455,7 +1453,7 @@ usage()
void help() __attribute__ ((__noreturn__));

void
help()
help(const list<Cmd>& cmds)
{
getopts.parse("help", GetOpts::no_options);
if (getopts.hasArgs())
Expand Down Expand Up @@ -1493,28 +1491,30 @@ main(int argc, char** argv)
setLogDo(&log_do);
setLogQuery(&log_query);

cmds.push_back(Cmd("list-configs", command_list_configs, help_list_configs, true, false));
cmds.push_back(Cmd("create-config", command_create_config, help_create_config, true, false));
cmds.push_back(Cmd("delete-config", command_delete_config, help_delete_config, true, false));
cmds.push_back(Cmd("get-config", command_get_config, help_get_config, true, false));
cmds.push_back(Cmd("set-config", command_set_config, help_set_config, true, true));
cmds.push_back(Cmd("list", { "ls" }, command_list, help_list, true, true));
cmds.push_back(Cmd("create", command_create, help_create, false, true));
cmds.push_back(Cmd("modify", command_modify, help_modify, false, true));
cmds.push_back(Cmd("delete", { "remove", "rm" }, command_delete, help_delete, false, true));
cmds.push_back(Cmd("mount", command_mount, help_mount, true, true));
cmds.push_back(Cmd("umount", command_umount, help_umount, true, true));
cmds.push_back(Cmd("status", command_status, help_status, false, true));
cmds.push_back(Cmd("diff", command_diff, help_diff, false, true));
const list<Cmd> cmds = {
Cmd("list-configs", command_list_configs, help_list_configs, true, false),
Cmd("create-config", command_create_config, help_create_config, true, false),
Cmd("delete-config", command_delete_config, help_delete_config, true, false),
Cmd("get-config", command_get_config, help_get_config, true, false),
Cmd("set-config", command_set_config, help_set_config, true, true),
Cmd("list", { "ls" }, command_list, help_list, true, true),
Cmd("create", command_create, help_create, false, true),
Cmd("modify", command_modify, help_modify, false, true),
Cmd("delete", { "remove", "rm" }, command_delete, help_delete, false, true),
Cmd("mount", command_mount, help_mount, true, true),
Cmd("umount", command_umount, help_umount, true, true),
Cmd("status", command_status, help_status, false, true),
Cmd("diff", command_diff, help_diff, false, true),
#ifdef ENABLE_XATTRS
cmds.push_back(Cmd("xadiff", command_xa_diff, help_xa_diff, false, true));
Cmd("xadiff", command_xa_diff, help_xa_diff, false, true),
#endif
cmds.push_back(Cmd("undochange", command_undo, help_undo, false, true));
Cmd("undochange", command_undo, help_undo, false, true),
#ifdef ENABLE_ROLLBACK
cmds.push_back(Cmd("rollback", command_rollback, help_rollback, false, true));
Cmd("rollback", command_rollback, help_rollback, false, true),
#endif
cmds.push_back(Cmd("cleanup", command_cleanup, help_cleanup, false, true));
cmds.push_back(Cmd("debug", command_debug, help_debug, false, false));
Cmd("cleanup", command_cleanup, help_cleanup, false, true),
Cmd("debug", command_debug, help_debug, false, false)
};

const struct option options[] = {
{ "quiet", no_argument, 0, 'q' },
Expand Down Expand Up @@ -1574,7 +1574,7 @@ main(int argc, char** argv)

if ((opt = opts.find("help")) != opts.end())
{
help();
help(cmds);
}

if (!getopts.hasArgs())
Expand Down

0 comments on commit 0b20a20

Please sign in to comment.