diff options
author | Stijn Buys <ingar@osirion.org> | 2009-11-14 14:14:21 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-11-14 14:14:21 +0000 |
commit | 4293e8854a30443e4d5818fc55df404976dbfd9b (patch) | |
tree | 816665ba37acfd5a39c0544c3b2acbf04c8c5d3d /src/core/commandbuffer.cc | |
parent | a993d31910b63a1f897e470842934e6ffefad32c (diff) |
update the info system, fixes network info exchange
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) |