ref: git lola and git lol as git plugins for ease of shipping
parent
75ba98e276
commit
2dd2ae2c08
|
@ -20,8 +20,8 @@ in {
|
|||
c = "commit";
|
||||
ca = "commit --amend";
|
||||
cm = "commit -m";
|
||||
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
|
||||
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
|
||||
# lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
|
||||
# lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
|
||||
sts = "status";
|
||||
co = "checkout";
|
||||
b = "branch";
|
||||
|
|
|
@ -151,12 +151,27 @@ in {
|
|||
'';
|
||||
example = [".direnv" "node_modules"];
|
||||
};
|
||||
plugins = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.package;
|
||||
default = [
|
||||
cell.packages.git-plus
|
||||
];
|
||||
description = ''
|
||||
Git plugins are just programs that are exposed to git-custom-command.
|
||||
Git takes the responsibility to do map it into `git custom-command`
|
||||
'';
|
||||
example = ''
|
||||
[ pkgs.git-filter-repo ]
|
||||
'';
|
||||
};
|
||||
# WARNING: This should be completed wtf
|
||||
config."${namespace}".git = {
|
||||
};
|
||||
config = {
|
||||
"${namespace}".git = {
|
||||
inherit (cfg) name email ignores aliases;
|
||||
enable = true;
|
||||
};
|
||||
home.packages = cfg.plugins;
|
||||
};
|
||||
};
|
||||
|
||||
git-htran = {
|
||||
|
|
|
@ -89,40 +89,7 @@ in {
|
|||
enableCompletion = true;
|
||||
initExtra = cfg.shellInitExtra or "";
|
||||
shellAliases =
|
||||
{
|
||||
git-lol = ''
|
||||
git log --graph --decorate --color=always --abbrev-commit \
|
||||
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
|
||||
while IFS= read -r line; do
|
||||
# Format the relative time
|
||||
line=$(echo "$line" | sed -e 's/ minute/ min/' \
|
||||
-e 's/ week/ wk/' \
|
||||
-e 's/ hour/ hr/' \
|
||||
-e 's/ month/ mo/' \
|
||||
-e 's/ year/ yr/' \
|
||||
-e 's/ ago//')
|
||||
|
||||
# Print the formatted line
|
||||
echo "$line"
|
||||
done | less -R
|
||||
'';
|
||||
git-lola = ''
|
||||
git log --graph --decorate --color=always --abbrev-commit --all\
|
||||
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
|
||||
while IFS= read -r line; do
|
||||
# Format the relative time
|
||||
line=$(echo "$line" | sed -e 's/ minute/ min/' \
|
||||
-e 's/ week/ wk/' \
|
||||
-e 's/ hour/ hr/' \
|
||||
-e 's/ month/ mo/' \
|
||||
-e 's/ year/ yr/' \
|
||||
-e 's/ ago//')
|
||||
|
||||
# Print the formatted line
|
||||
echo "$line"
|
||||
done | less -R
|
||||
'';
|
||||
}
|
||||
{ }
|
||||
// (cfg.shellAliases or {});
|
||||
};
|
||||
programs.zsh = {
|
||||
|
@ -133,38 +100,6 @@ in {
|
|||
{
|
||||
nix-rebuild = "sudo nixos-rebuild switch";
|
||||
hm-switch = "home-manager switch --flake";
|
||||
git-lol = ''
|
||||
git log --graph --decorate --color=always --abbrev-commit \
|
||||
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
|
||||
while IFS= read -r line; do
|
||||
# Format the relative time
|
||||
line=$(echo "$line" | sed -e 's/ minute/ min/' \
|
||||
-e 's/ week/ wk/' \
|
||||
-e 's/ hour/ hr/' \
|
||||
-e 's/ month/ mo/' \
|
||||
-e 's/ year/ yr/' \
|
||||
-e 's/ ago//')
|
||||
|
||||
# Print the formatted line
|
||||
echo "$line"
|
||||
done | less -R
|
||||
'';
|
||||
git-lola = ''
|
||||
git log --graph --decorate --color=always --abbrev-commit --all\
|
||||
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
|
||||
while IFS= read -r line; do
|
||||
# Format the relative time
|
||||
line=$(echo "$line" | sed -e 's/ minute/ min/' \
|
||||
-e 's/ week/ wk/' \
|
||||
-e 's/ hour/ hr/' \
|
||||
-e 's/ month/ mo/' \
|
||||
-e 's/ year/ yr/' \
|
||||
-e 's/ ago//')
|
||||
|
||||
# Print the formatted line
|
||||
echo "$line"
|
||||
done | less -R
|
||||
'';
|
||||
}
|
||||
// (cfg.shellAliases or {});
|
||||
history = {
|
||||
|
|
|
@ -41,4 +41,42 @@ in {
|
|||
pixi-edit = inputs.cells.dev.packages.pixi-edit;
|
||||
|
||||
nil = inputs.nixpkgs.nil;
|
||||
|
||||
git-plus = pkgs.symlinkJoin {
|
||||
name = "pegasust-git-plus";
|
||||
paths = [
|
||||
(pkgs.writeShellScriptBin "git-lola" ''
|
||||
git log --graph --decorate --color=always --abbrev-commit --all\
|
||||
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
|
||||
while IFS= read -r line; do
|
||||
# Format the relative time
|
||||
line=$(echo "$line" | sed -e 's/ minute/ min/' \
|
||||
-e 's/ week/ wk/' \
|
||||
-e 's/ hour/ hr/' \
|
||||
-e 's/ month/ mo/' \
|
||||
-e 's/ year/ yr/' \
|
||||
-e 's/ ago//')
|
||||
|
||||
# Print the formatted line
|
||||
echo "$line"
|
||||
done | less -R
|
||||
'')
|
||||
(pkgs.writeShellScriptBin "git-lol" ''
|
||||
git log --graph --decorate --color=always --abbrev-commit \
|
||||
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
|
||||
while IFS= read -r line; do
|
||||
# Format the relative time
|
||||
line=$(echo "$line" | sed -e 's/ minute/ min/' \
|
||||
-e 's/ week/ wk/' \
|
||||
-e 's/ hour/ hr/' \
|
||||
-e 's/ month/ mo/' \
|
||||
-e 's/ year/ yr/' \
|
||||
-e 's/ ago//')
|
||||
|
||||
# Print the formatted line
|
||||
echo "$line"
|
||||
done | less -R
|
||||
'')
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue