Version 0.0.2 added the variable env in json.
This commit is contained in:
parent
cc12b4765c
commit
709b7fd7ca
1 changed files with 61 additions and 8 deletions
31
appinfo.cpp
31
appinfo.cpp
|
|
@ -27,6 +27,11 @@ void AppInfo::setWorkingDir(std::string working_dir)
|
|||
this->working_dir = working_dir;
|
||||
}
|
||||
|
||||
void AppInfo::setEnv(string_map env)
|
||||
{
|
||||
this->env = env;
|
||||
}
|
||||
|
||||
void AppInfo::setAfter(std::unordered_map<std::string, std::string> after)
|
||||
{
|
||||
this->after = after;
|
||||
|
|
@ -89,6 +94,11 @@ std::string AppInfo::getWorkingDir() const
|
|||
return working_dir;
|
||||
}
|
||||
|
||||
AppInfo::string_map AppInfo::getEnv() const
|
||||
{
|
||||
return env;
|
||||
}
|
||||
|
||||
std::string AppInfo::getAfterString() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
|
@ -131,6 +141,7 @@ void AppInfo::copyFromData(AppInfo::AppData &other)
|
|||
this->args.push_back(i);
|
||||
}
|
||||
this->after = other.after;
|
||||
this->env = other.env;
|
||||
setRunMode(other.run_mode);
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +202,7 @@ void AppInfo::printInfo(std::ostream &out)
|
|||
if(!after.empty() && after.size() >= 2)
|
||||
after = after.substr(0,after.size() - 2);
|
||||
out << "After: " << after << std::endl;
|
||||
std::stringstream ss2;
|
||||
std::stringstream ss2, ss3;
|
||||
for(auto &[key, value]: parents) {
|
||||
if(!key) {
|
||||
ss2 << "Invalid Parent" << std::endl;
|
||||
|
|
@ -213,6 +224,13 @@ void AppInfo::printInfo(std::ostream &out)
|
|||
else {
|
||||
out << "Parents: None." << std::endl;
|
||||
}
|
||||
for(auto &[key,value]: env) {
|
||||
ss3 << key << "=" << value << ", ";
|
||||
}
|
||||
std::string env = ss3.str();
|
||||
if(!env.empty() && env.size() >= 2)
|
||||
env = env.substr(0,env.size() - 2);
|
||||
out << "Environment: " << env << std::endl;
|
||||
out << "Create Log: " << create_log << std::endl;
|
||||
out << "************************************End************************************" << std::endl;
|
||||
}
|
||||
|
|
@ -260,7 +278,7 @@ void AppInfo::AppData::printInfo(std::ostream &out)
|
|||
}
|
||||
out << "Run Mode: " << run_mode << std::endl;
|
||||
out << "Working Directory: " << AppData::working_dir << std::endl;
|
||||
std::stringstream ss;
|
||||
std::stringstream ss, ss2;
|
||||
for(auto &[key,value]: AppData::after) {
|
||||
ss << key << "[" << value << "], ";
|
||||
}
|
||||
|
|
@ -268,6 +286,15 @@ void AppInfo::AppData::printInfo(std::ostream &out)
|
|||
if(!after.empty() && after.size() >= 2)
|
||||
after = after.substr(0,after.size() - 2);
|
||||
out << "After: " << after << std::endl;
|
||||
ss.clear();
|
||||
ss.flush();
|
||||
for(auto &[key,value]: AppData::env) {
|
||||
ss2 << key << "=" << value << ", ";
|
||||
}
|
||||
std::string env = ss2.str();
|
||||
if(!env.empty() && env.size() >= 2)
|
||||
env = env.substr(0,env.size() - 2);
|
||||
out << "Environment: " << env << std::endl;
|
||||
out << "Create Log: " << AppData::create_log << std::endl;
|
||||
out << "************************************End************************************" << std::endl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue