tconbeer / harlequin

The SQL IDE for Your Terminal.
https://harlequin.sh
MIT License
3.67k stars 84 forks source link

harlequin --config should not prompt for config file if --config-path is specified #466

Closed erhhung closed 7 months ago

erhhung commented 8 months ago

Describe the bug

If I explicitly specify an existing config file to update using the --config-path option while also specifying --config to perform a guided configuration, Harlequin should not prompt me for the config file name—it should just print the --config-path value after confirming that it exists and can be read.

Also, if I run harlequin --config without --config-path, then it should look for an existing config file in the standard search paths and display that as the default response to the first prompt (user can still change it). If no existing config file exists in the search paths, then show .harlequin.toml as the default.

Standard config file search paths should be in this order:

To Reproduce

$ harlequin --config --config-path $XDG_CONFIG_HOME/harlequin/config.toml
? What config file do you want to create or update? .harlequin.toml

Actual behavior

harlequin --config forces me, in its first prompt, to enter the full path to the config file I want to update, despite I having already specified that path in --config-path so that I can leverage my shell's glob expansion and variable substitution capabilities (e.g. ~/ and $XDG_CONFIG_HOME).

Additional context

$ harlequin --version
harlequin, version 1.15.0

Installed Adapters:
  - duckdb, version 1.15.0
  - sqlite, version 1.15.0
  - postgres, version 0.2.2

Can you tell us more about your system?

tconbeer commented 7 months ago

Thanks for this issue. I just learned about $XDG_CONFIG_HOME and the related standard. I'll make the updates to use that standard (see #471 ). I'll keep this issue for the specific enhancement of passing --config-dir to the --config option.