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

Add the ability to pull configuration data from the environment. #643

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

erikogan
Copy link

(First off, let me say thank you for developing ag. It has made searching our large codebase(s) a snap!)

This PR adds environment variables for many of the command-line options.

I also added a command-line option (and environment variable) to ignore the environment for configuration.

In the case of a boolean configuration option, environment variables set without a value currently do not affect the value, but it would be easy enough to change that. (I am currently embroiled in a long argument with myself about how they should be handled.)

I am open to any comments you might have but especially the names of the functions and environment variables.

[Along the way, I noticed that opts.before & opts.after are both size_t, whereas opts.context is an int. I don’t think there is any value to a negative context, and I may open a separate issue/PR for that, since context is the only reason for the env_int_option function.]

Many of the command-line options now also have environment variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant