X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Ftools%2Frbd%2FShell.h;fp=src%2Fceph%2Fsrc%2Ftools%2Frbd%2FShell.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=682f95b554cd6095fc6f8d5d11122d15de07b51b;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/tools/rbd/Shell.h b/src/ceph/src/tools/rbd/Shell.h deleted file mode 100644 index 682f95b..0000000 --- a/src/ceph/src/tools/rbd/Shell.h +++ /dev/null @@ -1,76 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab - -#ifndef CEPH_RBD_SHELL_H -#define CEPH_RBD_SHELL_H - -#include "include/int_types.h" -#include -#include -#include -#include - -namespace rbd { - -class Shell { -public: - typedef std::vector Arguments; - typedef std::vector CommandSpec; - - struct Action { - typedef void (*GetArguments)(boost::program_options::options_description *, - boost::program_options::options_description *); - typedef int (*Execute)(const boost::program_options::variables_map &); - - CommandSpec command_spec; - CommandSpec alias_command_spec; - const std::string description; - const std::string help; - GetArguments get_arguments; - Execute execute; - bool visible; - - template - Action(const std::initializer_list &command_spec, - const std::initializer_list &alias_command_spec, - const std::string &description, const std::string &help, - Args args, Execute execute, bool visible = true) - : command_spec(command_spec), alias_command_spec(alias_command_spec), - description(description), help(help), get_arguments(args), - execute(execute), visible(visible) { - Shell::get_actions().push_back(this); - } - - }; - - struct SwitchArguments { - SwitchArguments(const std::initializer_list &arguments) { - Shell::get_switch_arguments().insert(arguments.begin(), arguments.end()); - } - }; - - int execute(const Arguments &argument); - -private: - static std::vector& get_actions(); - static std::set& get_switch_arguments(); - - void get_command_spec(const std::vector &arguments, - std::vector *command_spec); - Action *find_action(const CommandSpec &command_spec, - CommandSpec **matching_spec, bool *is_alias); - - void get_global_options(boost::program_options::options_description *opts); - - void print_help(); - void print_action_help(Action *action, bool is_alias); - void print_unknown_action(const CommandSpec &command_spec); - - void print_bash_completion(const CommandSpec &command_spec); - void print_bash_completion_options( - const boost::program_options::options_description &ops); -}; - -} // namespace rbd - -#endif // CEPH_RBD_SHELL_H