Skip to content

Support for environment variables #30

@lunaris

Description

@lunaris

Hey there. Would this library be open to a contribution that allowed supporting environment variables alongside command-line arguments? Something in line with commander's env method on Options, but with the typing benefits of ts-command-line-args. I'm envisaging an interface something like:

const args = parse<ICopyFilesArguments>({
  sourcePath: {
    type: String,
    env: "SOURCE_PATH",
  },
})

With the merge order being -- default values, configuration file, environment variables, command-line arguments. I'm not sure if this is something you feel falls under the remit of this library, but if it is, I'd be happy to help develop it. Our use case is largely one of backwards compatibility (we are porting some applications that support both command-line and environment variables to NodeJS) and a slightly better support for environment variables in some of the containerised environments we deploy to.

Thanks in advance for your thoughts and the work on the library so far!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions