Cli: Fix formatting of 'repository <type> list' command

refs #7255
This commit is contained in:
Michael Friedrich 2014-10-27 20:16:44 +01:00
parent 1d0a1564d9
commit 185f9b4080
2 changed files with 22 additions and 2 deletions

View File

@ -143,7 +143,7 @@ void ObjectListCommand::PrintObject(std::ostream& fp, bool& first, const String&
fp << "Object '";
fp << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << internal_name << ConsoleColorTag(Console_Normal) << "'";
fp << " of type '" << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << type << ConsoleColorTag(Console_Normal) << "':\n";
fp << " of type '" << ConsoleColorTag(Console_ForegroundMagenta | Console_Bold) << type << ConsoleColorTag(Console_Normal) << "':\n";
PrintProperties(fp, properties, debug_hints, 2);

View File

@ -133,12 +133,32 @@ void RepositoryUtility::PrintObjects(std::ostream& fp, const String& type)
continue;
}
fp << "Object Path: " << object << "\n";
String file = Utility::BaseName(object);
boost::algorithm::replace_all(file, ".conf", "");
fp << ConsoleColorTag(Console_ForegroundMagenta | Console_Bold) << type << ConsoleColorTag(Console_Normal)
<< " '" << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << file << ConsoleColorTag(Console_Normal) << "'";
String prefix = Utility::DirName(object);
if (type == "Service") {
std::vector<String> tokens;
boost::algorithm::split(tokens, prefix, boost::is_any_of("/"));
String host_name = tokens[tokens.size()-1];
fp << " (on " << ConsoleColorTag(Console_ForegroundMagenta | Console_Bold) << "Host" << ConsoleColorTag(Console_Normal)
<< " '" << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << host_name << ConsoleColorTag(Console_Normal) << "')";
}
fp << "\n";
/*
Dictionary::Ptr obj = GetObjectFromRepository(object); //TODO: config parser not implemented yet!
if (obj)
fp << JsonEncode(obj);
*/
}
}