akamensky / argparse

Argparse for golang. Just because `flag` sucks
MIT License
611 stars 62 forks source link

Envvars #75

Closed vbogretsov closed 3 years ago

vbogretsov commented 3 years ago

Added ability to initialize arguments from environment variables if user not provided values.

jkugler commented 3 years ago

Can you explain how this is different/better than just doing setting your default to os.Getenv('SOME_VAR') when you create the parser?

vbogretsov commented 3 years ago

Can you explain how this is different/better than just doing setting your default to os.Getenv('SOME_VAR') when you create the parser? For default from os.Getenv:

  1. Environment variable name will not be reflected in help
  2. Arguments with type list will not work
akamensky commented 3 years ago

@vbogretsov I would agree with @jkugler on this. This library is about parsing command line arguments. Configuration management and other thins (including handling environment variables) is not part of this library.

I would not want it to turn into another systemd type of thing.

But here is an idea, why not create a library to do just that. And if you want it to do that with argparse, you can use this library under the hood.

vbogretsov commented 3 years ago

A agree with you, closing PR.