refactor(tvix): getEnv(): Return std::optional

This allows distinguishing between an empty value and no value.

Patch ported from upstream at
ba87b08f85

Change-Id: I061cc8e16b1a7a0341adfc3b0edca1c0c51d5c97
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1884
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
This commit is contained in:
Eelco Dolstra 2019-11-22 16:06:44 +01:00 committed by glittershark
parent c5f3b12f04
commit 785cb3a754
17 changed files with 66 additions and 66 deletions

View file

@ -59,7 +59,7 @@ static int _main(int argc, char** argv) {
{
HashType ht = htSHA256;
std::vector<std::string> args;
bool printPath = !getEnv("PRINT_PATH").empty();
bool printPath = getEnv("PRINT_PATH").has_value();
bool fromExpr = false;
std::string attrPath;
bool unpack = false;