Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support documenting environment variables #682

Closed
astorije opened this issue Aug 20, 2017 · 4 comments
Closed

Support documenting environment variables #682

astorije opened this issue Aug 20, 2017 · 4 comments

Comments

@astorije
Copy link

When running atom -h from the command line, I got the following:

Atom Editor v1.19.2

Usage: atom [options] [path ...]

One or more paths to files or folders may be specified. If there is an
[...]
window.

Environment Variables:

  ATOM_DEV_RESOURCE_PATH  The path from which Atom loads source code in dev mode.
                          Defaults to `~/github/atom`.

  ATOM_HOME               The root path for all configuration files and folders.
                          Defaults to `~/.atom`.

Options:
  -1, --one                  This option is no longer supported.  [boolean]
  --include-deprecated-apis  This option is not currently supported.  [boolean]
  -d, --dev                  Run in development mode.  [boolean]
  [...]

It would be great if commander had a way to easily document environment variables like this.

Syntax could be: program.env('MY_ENV_VAR', 'This is the documentation for this environment variable'). There would be no enforcement, just for documentation purposes (correctly aligning them with each other, adding a section title "Environment variables" if there is any, etc.), but it would be very helpful.

In fact, in thelounge/lounge#1416, we have deprecated one of our options, --home, in favor of an environment variable, LOUNGE_HOME.
Documenting this in thelounge/lounge#1418 felt weird and is not ideal as we'll have to correctly document it in a future version, when we remove --home.

@roman-vanesyan
Copy link
Collaborator

You can specify necessary help information using program.on('--help', () => { ... }) construction.

@roman-vanesyan
Copy link
Collaborator

Thx for your time, we really appreciate it.
Will close as not interested in add such functionality, commander cannot cover all the userland ideas.
Feel free to reopen, if there's something more here 😄

@astorije
Copy link
Author

Well, that's unfortunate. I agree that --help can be used to achieve this, but it would feel more natural to have such a capability. In particular, we would not have to deal with padding, or setting up the header, as commander would do it, but I'm sure I'm forgetting advantages.

Using environment variables in a program is not a niche use case, and this would make it easy to document them. After all, they act as options under steroids (can be programmatically set) and it would be nice to document them similarly.

@astorije
Copy link
Author

BTW, I'm not able to reopen this issue, but wouldn't anyway as you explained your position :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants