diff options
Diffstat (limited to 'src/core/commandbuffer.cc')
-rw-r--r-- | src/core/commandbuffer.cc | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc index fc98e21..00a3486 100644 --- a/src/core/commandbuffer.cc +++ b/src/core/commandbuffer.cc @@ -44,11 +44,61 @@ void func_print_file(std::string const &args) void func_list_info(std::string const &args) { - Info *info = Info::find(args); - if (info) - info->print(); - else + std::string typestr; + std::string labelstr; + + std::istringstream argstream(args); + if (!(argstream >> typestr)) { + // no argument, list all info records Info::list(); + return; + } + + Info *info = 0; + InfoType *infotype = InfoType::find(typestr); + + if(!(argstream >> labelstr)) { + // a single argument + if (infotype) { + // list all the records of a single type + Info::list(infotype); + return; + } + + info = Info::find(typestr); + if (info) { + // list a single record + info->print(); + return; + } + + info = Info::search(typestr); + if (info) { + // list a single record + info->print(); + return; + } + + con_print << "Unkown info record '" << typestr << "'" << std::endl; + + } else { + // two arguments + info = Info::find(infotype, labelstr); + if (info) { + // list a single record + info->print(); + return; + } + + info = Info::search(infotype, labelstr); + if (info) { + // list a single record + info->print(); + return; + } + + con_print << "Unkown info record '" << typestr << "' for type '" << typestr << "'" << std::endl; + } } void func_list_func(std::string const &args) |