From c7a39d080449724d9d9648112bc8d901479ac1bd Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Sat, 18 Aug 2018 09:16:33 +0000 Subject: [PATCH] CHTSH_CONF specifies location of cht.sh.conf (fixes #59) --- README.md | 3 ++- share/cht.sh.txt | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0fd9c8f..81a9b16 100644 --- a/README.md +++ b/README.md @@ -284,7 +284,8 @@ Type `help` for other internal `cht.sh` commands. cht.sh/go> /python zip list ``` -The `cht.sh` client has its configuration file which is located at `~/.cht.sh/cht.sh.conf`. +The `cht.sh` client has its configuration file which is located at `~/.cht.sh/cht.sh.conf` +(location of the file can be overriden by the environment variable `CHTSH_CONF`). Use it to specify query options that you would use with each query. For example, to switch syntax highlighting off create the file with the following content: diff --git a/share/cht.sh.txt b/share/cht.sh.txt index 9af0e46..4be0209 100755 --- a/share/cht.sh.txt +++ b/share/cht.sh.txt @@ -133,9 +133,13 @@ gen_random_str() fi ) -if [ -e "$HOME"/.cht.sh/cht.sh.conf ]; then +if [ -z "$CHTSH_CONF" ]; then + CHTSH_CONF="$HOME"/.cht.sh/cht.sh.conf +fi + +if [ -e "$CHTSH_CONF" ]; then # shellcheck disable=SC1090,SC2002 - . "$HOME"/.cht.sh/cht.sh.conf + . "$CHTSH_CONF" fi if [ "$1" = --read ]; then