dbcli / pgcli

Postgres CLI with autocompletion and syntax highlighting
http://pgcli.com
BSD 3-Clause "New" or "Revised" License
12.08k stars 557 forks source link

Broken RC file behaviours. #1282

Open nestor-custodio opened 3 years ago

nestor-custodio commented 3 years ago

Description

I've identified 2 broken behaviours (detailed below) pertaining to how RC files are handled.

Scenario 1: in certain cases the RC file is moved

The Setup:

The Command:

The Outcome: Note I cannot verify exactly what order some of the below items occur in, as I can only attest to what order I see output generated in.

The Problem:

The Expectation:

Scenario 2: in certain cases the RC file is moved and also replaced with the default config

Thinking that explicitly setting the --pgclirc option might make it clear that "this is where my config file is and this is where you should read it from, do nothing else please and thank you", I found a related (but somehow worse) problem.

The Setup:

The Command:

The Outcome: Note I cannot verify exactly what order some of the below items occur in, as I can only attest to what order I see output generated in.

The Problem:

The Expectation:

Your Environment

amjith commented 3 years ago

Thanks for the detailed walk through of the multiple scenarios.

We don't use the home folder to keep our rc files. We only use ~/.config/pgcli/config location.

When pgcli was first created we were using ~/.pgclirc file and we were told this behavior of storing rc files in home folder is antiquated and we should really be using XDG_CONFIG_HOME location. Hence the change.

We copy the file from ~/.pgclirc to ~/.config/pgcli/config as a means of easing the transition for users so they don't have to start from scratch due to the sudden change in rc file location.

You point about rc file backup doesn't make sense to me. The rc file backup should backup the file located in ~/.config/pgcli/config location and not the ~/.pgclirc file.

nestor-custodio commented 3 years ago

Ah. If you're sticking to XDGBDS, that makes sense and I consider item 1 addressed.

I would still argue, however, that (a) the --pgclirc flag should be respected with no side effects, and that (b) --pgclirc="~/.pgclirc" resulting in a default config being loaded regardless of the file's original contents is a legitimate bug.