| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | EnvironmentOptions.h |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | Maps environment variables onto ArgTypes for early CLI configuration. |
| 12 | |
| 13 | --*/ |
| 14 | #pragma once |
| 15 | #include "Argument.h" |
| 16 | #include "ArgMap.h" |
| 17 | |
| 18 | #include <vector> |
| 19 | |
| 20 | namespace wsl::windows::wslc { |
| 21 | |
| 22 | // Binding contract: presence of Name sets the option. The value is ignored |
| 23 | // for Flag kinds and stored verbatim for Value kinds. To opt out, unset the |
| 24 | // variable. |
| 25 | struct EnvBinding |
| 26 | { |
| 27 | const wchar_t* Name; |
| 28 | ArgType Type; |
| 29 | }; |
| 30 | |
| 31 | // Many-to-one allowed: multiple env var names may bind to one ArgType. |
| 32 | constexpr EnvBinding c_envBindings[] = { |
| 33 | {L"NO_COLOR", ArgType::NoColor}, |
| 34 | }; |
| 35 | |
| 36 | // Populates target for any ArgType in definedArgs not already set. |
| 37 | // Never throws on user input or environment state. |
| 38 | void ApplyEnvironmentOptions(argument::ArgMap& target, const std::vector<Argument>& definedArgs) noexcept; |
| 39 | |
| 40 | } // namespace wsl::windows::wslc |