Skip to content

ResolutionProvenance

Which stage produced a resolved value, and how.

via and trigger distinguish the two ways stdin delivers bytes. An explicit - keeps CLI precedence and reports { stage: 'cli', via: 'stdin', trigger: 'dash' }; an absent input takes the fallback stage between CLI and env and reports { stage: 'stdin', via: 'stdin', trigger: 'fallback' }.

Signatures

ts
type ResolutionProvenance = { stage: "cli"; } | { stage: "cli"; trigger: "dash"; via: "stdin"; } | { stage: "stdin"; trigger: "fallback"; via: "stdin"; } | { envVar: string; stage: "env"; } | { configPath: string; stage: "config"; } | { stage: "prompt"; } | { stage: "default"; };

Examples

ts
command('deploy')
  .flag('region', flag.string().env('REGION').default('us'))
  .action(({ sources }) => {
    const region = sources.flags.region;
    if (region?.stage === 'env') console.log(`from ${region.envVar}`);
  });

See Also

Released under the MIT License.