Example #1
0
//{{{ class SysBashCmd   method
SysBashCmd::SysBashCmd(const char *const name) : Cmd(name) {
    optMgr_.setShortDes("opens a new bash shell environment");
    optMgr_.setDes("opens a new bash shell environment");
    Opt *opt = new Opt(Opt::BOOL, "print usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    optMgr_.regOpt(opt);
}
Example #2
0
//}}}
//{{{ class SysPwdCmd    method
SysPwdCmd::SysPwdCmd(const char *const name) : Cmd(name) {
    optMgr_.setShortDes("print name of current directory");
    optMgr_.setDes("prints the full filename of the current working directory");
    Opt *opt = new Opt(Opt::BOOL, "print usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    optMgr_.regOpt(opt);
}
Example #3
0
//}}}
//{{{ class SysCatCmd    method
SysCatCmd::SysCatCmd(const char *const name) : Cmd(name) {
    optMgr_.setShortDes("concatenate files and print on the standard output");
    optMgr_.setDes("Concatenate FILE(s), or standard input, to standard output");
    optMgr_.regArg(new Arg(Arg::REQ_INF, "files to be printed", "FILE"));
    Opt *opt = new Opt(Opt::BOOL, "print usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    optMgr_.regOpt(opt);
}
Example #4
0
//}}}
//{{{ class SysListCmd   method
SysListCmd::SysListCmd(const char *const name) : Cmd(name) {
    optMgr_.setShortDes("list diectory contents");
    optMgr_.setDes("lists contents in DIRECTORY. If not specified, list current directory content.");
    optMgr_.regArg(new Arg(Arg::OPT, "target directories", "DIRECTORY"));
    Opt *opt = new Opt(Opt::BOOL, "print usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    optMgr_.regOpt(opt);
}
Example #5
0
//{{{ class SysDisplayCmd   method
SysDisplayCmd::SysDisplayCmd(const char *const name) : Cmd(name) {
  optMgr_.setShortDes("disply picture in X-window");  // short 
  optMgr_.setDes("call the system function display."); // long 
  optMgr_.regArg(new Arg(Arg::OPT, "file name of the picture. can be in jpg, png, gif format ", "FILENAME"));
  Opt *opt = new Opt(Opt::BOOL, "print usage", "");
  opt->addFlag("h");
  opt->addFlag("help");
  optMgr_.regOpt(opt);
}
Example #6
0
//}}}
//{{{ class SysExitCmd   method
SysExitCmd::SysExitCmd(const char *const name, CmdMgr *cmdMgr) : Cmd(name) {
    cmdMgr_ = cmdMgr;
    optMgr_.setShortDes("exit the program");
    optMgr_.setDes("exits the program");
    Opt *opt = new Opt(Opt::BOOL, "print usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    optMgr_.regOpt(opt);
}
Example #7
0
//}}}
//{{{class SysCdCmd     method
SysCdCmd::SysCdCmd(const char *const name) : Cmd(name) {
    optMgr_.setShortDes("change directory");
    optMgr_.setDes("changes working directory to DIRECTORY. If not specified, changes to home directory.");
    optMgr_.regArg(new Arg(Arg::OPT, "target directories", "DIRECTORY"));
    Opt *opt = new Opt(Opt::BOOL, "print usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    optMgr_.regOpt(opt);
}
Example #8
0
//}}}
//{{{ class SysHelpCmd   method
SysHelpCmd::SysHelpCmd(const char *const name, CmdMgr *cmdMgr) : Cmd(name) {
    cmdMgr_ = cmdMgr;
    optMgr_.setShortDes("print help messages");
    optMgr_.setDes("prints help for COMMAND. If not specified, prints the usage of the command manager.");
    optMgr_.regArg(new Arg(Arg::OPT, "target command", "COMMAND"));
    Opt *opt = new Opt(Opt::BOOL, "print usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    optMgr_.regOpt(opt);
}
Example #9
0
//}}}
//{{{ class SysSourceCmd method
SysSourceCmd::SysSourceCmd(const char *const name, CmdMgr *cmdMgr) : Cmd(name) {
    cmdMgr_ = cmdMgr;
    optMgr_.setShortDes("run commands from startup file");
    optMgr_.setDes("runs commands from FILE");
    optMgr_.regArg(new Arg(Arg::REQ, "target file with commands", "FILE"));
    Opt *opt = new Opt(Opt::BOOL, "print usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    optMgr_.regOpt(opt);
}
Example #10
0
//}}}
//{{{ class SysSetCmd    method
SysSetCmd::SysSetCmd(const char *const name, CmdMgr *cmdMgr) : Cmd(name) {
    cmdMgr_ = cmdMgr;
    optMgr_.setShortDes("set variables");
    optMgr_.setDes("set VAR to VALUE");
    optMgr_.regArg(new Arg(Arg::OPT, "variable name", "VAR"));
    optMgr_.regArg(new Arg(Arg::OPT, "value of the variable", "VALUE"));
    Opt *opt = new Opt(Opt::BOOL, "print usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    optMgr_.regOpt(opt);
}
Example #11
0
void initOpts(OptMgr *mgr) {
    // set program information
    mgr->setName("test");
    mgr->setShortDes("test based");
    mgr->setDes("test based");

    // register options
    Opt *opt = new Opt(Opt::BOOL, "print this usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    mgr->regOpt(opt);

    opt = new Opt(Opt::STR_REQ, "execute command file at startup", "FILE");
    opt->addFlag("f");
    mgr->regOpt(opt);
}
Example #12
0
//}}}
//{{{ class SysDotCmd    method
SysDotCmd::SysDotCmd(const char * const name) : Cmd(name) {
    optMgr_.setShortDes("call system dot filter");
    optMgr_.setDes("convert a graph in dot language to a picture");

    optMgr_.regArg(new Arg(Arg::REQ, "input dot file", "INPUT"));

    Opt *opt = new Opt(Opt::BOOL, "print usage", "");
    opt->addFlag("h");
    opt->addFlag("help");
    optMgr_.regOpt(opt);

    opt = new Opt(Opt::STR_REQ,
                  "output format. Default is jpg",
                  "bmp|jpg|ps|png ...");
    opt->addFlag("T");
    optMgr_.regOpt(opt);

    opt = new Opt(Opt::STR_REQ,
                  "output file. Default is <input>.<format>",
                  "OUTPUT");
    opt->addFlag("o");
    optMgr_.regOpt(opt);
}