home/git: add addr command
This commit is contained in:
@@ -360,6 +360,11 @@ lib.mkIf cfg.enable {
|
||||
runtimeInputs = with pkgs; [ cfg.package gnused gnugrep gawk uutils-coreutils-noprefix ];
|
||||
text = lib.fileContents ./scripts/git-author-lines.sh;
|
||||
})
|
||||
(pkgs.writeShellApplication {
|
||||
name = "git-addr";
|
||||
runtimeInputs = with pkgs; [ cfg.package ];
|
||||
text = lib.fileContents ./scripts/git-addr.sh;
|
||||
})
|
||||
(pkgs.writeShellApplication {
|
||||
name = "git-all-commits";
|
||||
runtimeInputs = with pkgs; [ cfg.package gnugrep gawk findutils uutils-coreutils-noprefix ];
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
GIT_ROOT_DIR="$(git rev-parse --show-toplevel)"
|
||||
|
||||
if [ "$GIT_ROOT_DIR" = "" ]; then
|
||||
echo "Not a git repository"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Transform all file args to prepend the git root dir
|
||||
declare -a FINAL_ARGS
|
||||
|
||||
for i in "$@"; do
|
||||
if [ -f "$GIT_ROOT_DIR/$i" ]; then
|
||||
FINAL_ARGS+=("$GIT_ROOT_DIR/$i")
|
||||
else
|
||||
FINAL_ARGS+=("$i")
|
||||
fi
|
||||
done
|
||||
|
||||
exec git add "${FINAL_ARGS[@]}"
|
||||
Reference in New Issue
Block a user