forked from ggreer/the_silver_searcher
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for config files, based on discussion in ggreer#257
I took David Schlosnagle's code (@schlosna) and adapted it to follow the many of the suggestions discussed in issue ggreer#257. Changes between David's code and my adaptation: 1) Almost 100% of the code lives in 2 new source files. src/options.c is not touched. 2) Consequently, merging this code with current forks is pretty easy. 3) Also due to #1, if you know C, you can hack the config file features to your heart's content. 4) Multiple config file locations are tested at startup (first found file wins, all others ignored). Here are the locations and order of access: 1. Path specified in $AGRC_PATH 2. $XDG_CONFIG_HOME/agrc 3. ~/.agrc 4. /usr/local/etc/agrc 5. /etc/agrc 5) Config file format: # this is a comment => inline comments not supported # blank lines okay as well --long-option[=value] -short-option[=value] --long-option[ value] -short-option[ value] # And special keywords (of which there is only one) list Actual Example File (mine) # set up nice colors for a white terminal bkgnd... # bold blue --color-line-number=1;34 # black with grey bkgnd --color-match=30;47 # green --color-path=32 The features and paths are documented in the ag man page.
- Loading branch information
Showing
6 changed files
with
427 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.