pgcli icon indicating copy to clipboard operation
pgcli copied to clipboard

Document environment variables that can replace command line options

Open liberforce opened this issue 6 years ago • 0 comments

Description

Noob using pgcli here. I was trying to configure my environment, and at some point, I started getting always the same error, about a bad DSN in my config file. The problem is that I had not touched that file, and removing it would not solve the problem.

It turns out I had configured the DSN environment variable (I wanted to call pgcli $DSN to easily connect to my database), but this variable is used by pgcli to lookup for a DSN in the config file. The problem is that this information is available neither in the manpage nor in the --help output. I had to give a look to the code for that.

Environment variables should be visible in the help and man. They could appear near the option they can replace, like what gitlab-runner does for example:

gitlab-runner register --help
NAME:
   gitlab-runner register - register a new runner

USAGE:
   gitlab-runner register [command options] [arguments...]

OPTIONS:
   -c value, --config value                              Config file (default: "/home/luismenina/.gitlab-runner/config.toml") [$CONFIG_FILE]
   --tag-list value                                      Tag list [$RUNNER_TAG_LIST]
   -n, --non-interactive                                 Run registration unattended [$REGISTER_NON_INTERACTIVE]
   --leave-runner                                        Don't remove runner if registration fails [$REGISTER_LEAVE_RUNNER]
   -r value, --registration-token value                  Runner's registration token [$REGISTRATION_TOKEN]

...

Environment

  • [X] Ubuntu 18.04
  • [X] Pgcli 1.6.0
  • [X] pip freeze: irrelevant

liberforce avatar Jun 04 '19 10:06 liberforce