mirror of
https://github.com/iwata/git-now.git
synced 2026-09-10 15:36:22 -04:00
Prefix config
This commit is contained in:
parent
fc8b07c108
commit
5f3a359a0f
15
git-now
15
git-now
|
|
@ -9,7 +9,20 @@ GITNOW_DIR=$0
|
|||
GITNOW_DIR=${GITNOW_DIR%\\*} # for msysGit
|
||||
GITNOW_DIR=${GITNOW_DIR%/*} # for others
|
||||
export GITNOW_DIR
|
||||
PREFIX="from now"
|
||||
|
||||
prefix_config=`git config now.prefix`
|
||||
if [ $? -eq 0 ]; then
|
||||
PREFIX=$prefix_config
|
||||
else
|
||||
PREFIX="from now"
|
||||
fi
|
||||
|
||||
bracket_config=`git config now.bracket`
|
||||
if [ $? -eq 0 ]; then
|
||||
BRACKET=$bracket_config
|
||||
else
|
||||
BRACKET=true
|
||||
fi
|
||||
|
||||
usage() {
|
||||
echo "usage: git now [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,13 @@ usage() {
|
|||
}
|
||||
|
||||
cmd_default() {
|
||||
MESSAGE="[${PREFIX}] `date +\"%Y/%m/%d %T\"`"
|
||||
if [ $BRACKET = "true" ]; then
|
||||
prefix_str="[${PREFIX}]"
|
||||
else
|
||||
prefix_str=$PREFIX
|
||||
fi
|
||||
MESSAGE="${prefix_str} `date +\"%Y/%m/%d %T\"`"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
git add -u
|
||||
printf "${MESSAGE}\n\n%s" "`git diff --cached --no-ext-diff`" | git commit -F -
|
||||
|
|
|
|||
Loading…
Reference in a new issue