-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc_comment.nix
38 lines (32 loc) · 1005 Bytes
/
c_comment.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ pkgs, lib, ... }:
with pkgs;
pkgs.writeScriptBin ":comment" ''
#!${lib.getExe bash}
SYS_CLIPBOARD=clip.exe
JIRAUSER=mtalbergs
BITBUCKET_PROJECT=https://git.zabbix.com/projects/ZBX/repos/zabbix
fzclip() {
local -n clips=$1
local IFS=$'\n'
echo "${
lib.strings.concatStrings [
# escaping "$" in nix string
"$"
"{clips[*]}"
]
}" | ${fzf}/bin/fzf | $SYS_CLIPBOARD
}
SHA="$(git rev-parse HEAD | head -c 11)"
SHALINK="[$SHA|$BITBUCKET_PROJECT/commits/$SHA]"
CLIPS=("<[~$JIRAUSER]> CLOSED")
CLIPS+=("<[~$JIRAUSER]> WON'T FIX")
CLIPS+=("*(1)* No translation string changes.")
CLIPS+=("<[~$JIRAUSER]> CLOSED with minor fix in $SHALINK")
CLIPS+=("<[~$JIRAUSER]> RESOLVED in $SHALINK")
CLIPS+=("<[~$JIRAUSER]> IMPLEMENTED in $SHALINK")
CLIPS+=("$SHALINK")
CLIPS+=("git cherry-pick -m 1 -x $SHA")
CLIPS+=("git merge origin/$REF --no-ff --no-commit")
CLIPS+=("Code review successful.")
fzclip CLIPS
''