MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / get_value_from_env

Method get_value_from_env

subprojects/llama.cpp/common/arg.cpp:116–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116bool common_arg::get_value_from_env(std::string & output) const {
117 if (env == nullptr) return false;
118 if (!args_neg.empty()) {
119 // for compatibility, we need to check LLAMA_ARG_NO_ env as well
120 std::string neg_env = env;
121 string_replace_all(neg_env, "LLAMA_ARG_", "LLAMA_ARG_NO_");
122 char * neg_value = std::getenv(neg_env.c_str());
123 if (neg_value) {
124 output = "0"; // falsey
125 return true;
126 }
127 }
128 char * value = std::getenv(env);
129 if (value) {
130 output = value;
131 return true;
132 }
133 return false;
134}
135
136bool common_arg::has_value_from_env() const {
137 if (env != nullptr && !args_neg.empty()) {

Callers 1

common_params_parse_exFunction · 0.80

Calls 2

string_replace_allFunction · 0.70
emptyMethod · 0.65

Tested by

no test coverage detected