Skip to content

Commit

Permalink
CHTSH_CONF specifies location of cht.sh.conf (fixes #59)
Browse files Browse the repository at this point in the history
  • Loading branch information
chubin committed Aug 18, 2018
1 parent 1501515 commit c7a39d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 6 additions & 2 deletions share/cht.sh.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c7a39d0

Please sign in to comment.