@@ -1029,7 +1029,7 @@ class DIMCLI_LIB_DECL Cli {
10291029 OptBase & opt,
10301030 const std::string & val
10311031 );
1032- static void argSrcResolveAction (
1032+ static void argSrcFileRelAction (
10331033 Cli & cli,
10341034 OptBase & opt,
10351035 const std::string & val
@@ -1896,7 +1896,10 @@ class Cli::OptShim : public OptBase {
18961896 int flags = 0 // Cli::fPrompt* flags
18971897 );
18981898
1899- A & argSrcRelative ();
1899+ // When srcType is ArgSrc::kFile values are interpreted as file paths and,
1900+ // if the argument also has kFile srcType, resolved relative to the file
1901+ // source of the argument. Other source types are not supported.
1902+ A & resolve (ArgSrc::Type srcType);
19001903
19011904 // Function signature of actions that are tied to options.
19021905 using ActionFn = void (Cli & cli, A & opt, const std::string & val);
@@ -2370,8 +2373,10 @@ A & Cli::OptShim<A, T>::prompt(const std::string & msg, int flags) {
23702373
23712374// ===========================================================================
23722375template <typename A, typename T>
2373- A & Cli::OptShim<A, T>::argSrcRelative() {
2374- return parse (Cli::argSrcResolveAction).valueDesc (" FILE" );
2376+ A & Cli::OptShim<A, T>::resolve(ArgSrc::Type srcType) {
2377+ if (srcType == ArgSrc::kFile )
2378+ parse (Cli::argSrcFileRelAction).valueDesc (" FILE" );
2379+ return static_cast <A &>(*this );
23752380}
23762381
23772382
@@ -2496,7 +2501,7 @@ inline bool Cli::Opt<T>::parseValue(const std::string & value) {
24962501template <>
24972502inline // static
24982503void Cli::Opt<DIMCLI_LIB_FILESYSTEM_PATH>::initConfig(Cli &) {
2499- argSrcRelative ( );
2504+ resolve (ArgSrc:: kFile );
25002505}
25012506#endif
25022507
@@ -2715,7 +2720,7 @@ inline bool Cli::OptVec<T>::parseValue(const std::string & value) {
27152720template <>
27162721inline // static
27172722void Cli::OptVec<DIMCLI_LIB_FILESYSTEM_PATH>::initConfig(Cli &) {
2718- argSrcRelative ( );
2723+ resolve (ArgSrc:: kFile );
27192724}
27202725#endif
27212726
0 commit comments