mirror of
https://github.com/ksherlock/mpw-shell.git
synced 2025-01-15 03:30:00 +00:00
Environment::get
This commit is contained in:
parent
a7dce37fe6
commit
a6913f7c46
@ -20,6 +20,11 @@ namespace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Environment::get(const std::string & key) const {
|
||||||
|
auto iter = find(key);
|
||||||
|
if (iter == end()) return "";
|
||||||
|
return iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
Environment::iterator Environment::find( const std::string & key ) {
|
Environment::iterator Environment::find( const std::string & key ) {
|
||||||
std::string k(key);
|
std::string k(key);
|
||||||
|
@ -56,13 +56,13 @@ public:
|
|||||||
void unset(const std::string &k);
|
void unset(const std::string &k);
|
||||||
void unset();
|
void unset();
|
||||||
|
|
||||||
|
std::string get(const std::string &k) const;
|
||||||
|
|
||||||
constexpr bool echo() const noexcept { return _echo; }
|
constexpr bool echo() const noexcept { return _echo; }
|
||||||
constexpr bool test() const noexcept { return _test; }
|
constexpr bool test() const noexcept { return _test; }
|
||||||
constexpr bool exit() const noexcept { return _and_or ? false : _exit; }
|
constexpr bool exit() const noexcept { return _exit; }
|
||||||
constexpr int status() const noexcept { return _status; }
|
constexpr int status() const noexcept { return _status; }
|
||||||
|
|
||||||
bool and_or(bool v) { std::swap(v, _and_or); return v; }
|
|
||||||
|
|
||||||
int status(int i, bool throw_up = true);
|
int status(int i, bool throw_up = true);
|
||||||
int status(int i, const std::nothrow_t &);
|
int status(int i, const std::nothrow_t &);
|
||||||
|
|
||||||
@ -108,8 +108,6 @@ private:
|
|||||||
bool _exit = false;
|
bool _exit = false;
|
||||||
bool _test = false;
|
bool _test = false;
|
||||||
|
|
||||||
bool _and_or = false;
|
|
||||||
|
|
||||||
bool _echo = false;
|
bool _echo = false;
|
||||||
int _status = 0;
|
int _status = 0;
|
||||||
bool _startup = false;
|
bool _startup = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user