cespare / reflex

Run a command when files change
MIT License
3.35k stars 135 forks source link

Use default config file if exists #68

Open zrhmn opened 4 years ago

zrhmn commented 4 years ago

Fixes #41

I was going through my issues list and saw that I had opened a feature request (2.5 years ago, sorry) for a "rc file" in the current directory, such that if it exists, it is automatically used if --config flag is not set. I believe we settled on a straightforward name for the config file: reflex.conf. This PR implements that in a very simple, straightforward way:

Before the config flag is processed, we check if it's empty and if reflex.conf exists. If it does, the flag is quietly set to that value before rest of the flag processing takes place. I also modified the wording of an error to indicate that the flag validation behavior is the same whether --config flag is specified or assumed (to be =reflex.conf).

I tested this by building the reflex binary and running it in a directory with and without a reflex.conf file and it seems to meet the expectations in this rudimentary, manual test. I'm not sure how to add an automated test for this. Contents of main() do not seem to be autotested anyway.

I should also update the documentation before this is ready for review.

Edit: Also, prefer not to add my name to authors list. This is extremely trivial and I don't feel that I deserve the credit.

zrhmn commented 4 years ago

Bump for visibility. Question above.

duraki commented 1 year ago

@cespare can you review please? Its been so long tho.