Add todo command to gut
gut todo `git grep`'s for todo's and fixme's based on flags. By default it outputs a summary (-c). Add very important comment to confirm
This commit is contained in:
parent
93d7497e7d
commit
569ee93828
|
@ -71,6 +71,7 @@ main(int argc, const char *argv[])
|
||||||
// Options provided as args
|
// Options provided as args
|
||||||
if (argc > 1) return confirm(argv[0], argv+1, argc-1);
|
if (argc > 1) return confirm(argv[0], argv+1, argc-1);
|
||||||
|
|
||||||
|
// Options not provided -- use defaults
|
||||||
const char **opts = STR_EALLOC(2);
|
const char **opts = STR_EALLOC(2);
|
||||||
opts[0] = "y";
|
opts[0] = "y";
|
||||||
opts[1] = "n";
|
opts[1] = "n";
|
||||||
|
|
22
src/gut.sh
22
src/gut.sh
|
@ -64,6 +64,28 @@ status() {
|
||||||
git status --short
|
git status --short
|
||||||
}
|
}
|
||||||
|
|
||||||
|
todo() {
|
||||||
|
while [ "$#" -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
"-d") detail=true ;;
|
||||||
|
"-c") colorize=true ;;
|
||||||
|
"-f") fixme=true ;;
|
||||||
|
*) break ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
re="(TODO$(truthy $fixme && echo '|FIXME')):"
|
||||||
|
color="--color=$(truthy $colorize && echo 'always' || echo 'never')"
|
||||||
|
if truthy $detail; then
|
||||||
|
# TODO: Setting color=always breaks alignment for some reason
|
||||||
|
git grep -nE "$color" $@ "$re" | \
|
||||||
|
sed 's/\([^:]*:[^:]*\):[ \t]*\(.*\)/\1\t\2/'
|
||||||
|
else
|
||||||
|
git grep -ncE $@ '(TODO|FIXME):'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
whoami() {
|
whoami() {
|
||||||
echo "$(git config user.name) ($(git config user.email))"
|
echo "$(git config user.name) ($(git config user.email))"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue