;fix: bin: hledger-git: add short command aliases r, s, l
This commit is contained in:
parent
e986bdf2d5
commit
1e1b26261d
@ -16,8 +16,10 @@ hledger git status - show unrecorded changes in journal's files (after fir
|
|||||||
hledger git log - list recorded changes in journal's files (after first record)
|
hledger git log - list recorded changes in journal's files (after first record)
|
||||||
hledger git GITARGS - run another git command in this repo, on all files
|
hledger git GITARGS - run another git command in this repo, on all files
|
||||||
|
|
||||||
Extra arguments are passed to git (git-specific flags should be preceded by --).
|
The shorter r, s, l command aliases may be used instead.
|
||||||
You can install these as more convenient top-level commands by creating
|
Extra/unrecognised arguments are passed to git. Git-specific flags should be preceded by --.
|
||||||
|
|
||||||
|
You can install this as more convenient top-level commands by creating
|
||||||
hledger-record, hledger-status, hledger-log scripts like:
|
hledger-record, hledger-status, hledger-log scripts like:
|
||||||
|
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
@ -25,9 +27,9 @@ hledger-record, hledger-status, hledger-log scripts like:
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
hledger git status
|
$ hledger git s # briefly show status of journal's files
|
||||||
hledger git log -10
|
$ hledger git l -10 # briefly list last 10 recorded changes to journal's files
|
||||||
hledger git log -- -10 --stat
|
$ hledger git l -- --stat # list recorded changes to journal's files with summaries
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@ -81,11 +83,13 @@ record() {
|
|||||||
fi
|
fi
|
||||||
$GIT commit -m "$MSG" "$@" || $GIT reset
|
$GIT commit -m "$MSG" "$@" || $GIT reset
|
||||||
}
|
}
|
||||||
|
r() { record "$@"; }
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
ensure_git
|
ensure_git
|
||||||
$GIT --work-tree "$DIR" status -sb "$@" -- $FILES
|
$GIT --work-tree "$DIR" status -sb "$@" -- $FILES
|
||||||
}
|
}
|
||||||
|
s() { status "$@"; }
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
ensure_git
|
ensure_git
|
||||||
@ -95,6 +99,7 @@ log() {
|
|||||||
# TODO: limit to hledger files
|
# TODO: limit to hledger files
|
||||||
$GIT log --format='%ad %h %s' --date=short "$@"
|
$GIT log --format='%ad %h %s' --date=short "$@"
|
||||||
}
|
}
|
||||||
|
l() { log "$@"; }
|
||||||
|
|
||||||
# * Main
|
# * Main
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user