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

Providing the command argument from a config file does not work #2231

Closed
simonmichael opened this issue Sep 13, 2024 · 2 comments
Closed

Providing the command argument from a config file does not work #2231

simonmichael opened this issue Sep 13, 2024 · 2 comments
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. cli Command line parsing, options, arguments and suchlike. docs Documentation-related. impact3 Affects just a few users. severity2 Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate.

Comments

@simonmichael
Copy link
Owner

simonmichael commented Sep 13, 2024

When a command argument is not provided on the command line, but in the general section of a config file, I expected that it would be used as the command, but is not; rather it is ignored. (Reported by sol in chat.)

CLI parsing is already complicated, so implementing this is tricky. If it worked,

  • it would restrict hledger to that one command when using that config file
  • a command-specific config file section for that command would also take effect
  • any command-specific sections for other commands would be ignored.

As a workaround, you can achieve the same effect by making the config file a shebang script and adding the command argument to the shebang line.

But it may seem surprising/inconsistent that this doesn't work. We should implement it or document it.

@simonmichael simonmichael changed the title a command argument in a config file's general section is not used Providing the command argument in a config file's general section does not work Sep 13, 2024
@simonmichael simonmichael added A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. docs Documentation-related. cli Command line parsing, options, arguments and suchlike. severity2 Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate. impact3 Affects just a few users. labels Sep 13, 2024
@simonmichael simonmichael changed the title Providing the command argument in a config file's general section does not work Providing the command argument from a config file does not work Sep 13, 2024
@simonmichael
Copy link
Owner Author

Documented for now.

@simonmichael
Copy link
Owner Author

This now works in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. cli Command line parsing, options, arguments and suchlike. docs Documentation-related. impact3 Affects just a few users. severity2 Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate.
Projects
None yet
Development

No branches or pull requests

1 participant