env: only use color diffs on terminals
[openwrt/openwrt.git] / scripts / env
index 24d4bec64f06953695ea3bc0dfafb233d33f96d7..84166ae5fe45ddeefb82f060fb8d3d1b898e81c9 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/env bash
 BASEDIR="$PWD"
 ENVDIR="$PWD/env"
+export GREP_OPTIONS=
 
 usage() {
        cat <<EOF
@@ -14,7 +15,8 @@ Commands:
        delete <name>     Delete an environment
        rename <newname>  Rename the current environment
        diff              Show differences between current state and environment
-       save              Save your changes to the environment
+       save [message]    Save your changes to the environment, optionally using
+                         the given commit message
        revert            Revert your changes since last save
 
 Options:
@@ -102,13 +104,13 @@ env_list() {
 env_diff() {
        env_init
        env_sync_data
-       git diff --cached --color
+       git diff --cached --color=auto
        env_link_config
 }
 
 env_save() {
        env_init
-       env_sync
+       env_sync "$@"
        env_link_config
 }