-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample.dt
75 lines (69 loc) · 1.5 KB
/
example.dt
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
menu root {
g: git
m: misc
r: rust
c: config
}
menu config {
b: "bash base" - "helix $DOTFILES/bash/base_config.bash"
l: "bash local" - "helix ~/.bashrc.local"
i: "i3" - "nvim ~/.config/i3/config"
d: "dotree" - "helix ~/.config/dotree.dt"
n: "nvim" - "nvim ~/.config/nvim/init.lua"
}
menu rust {
c: "check paged" - "cargo check --color always 2>&1 | less -r"
l: "count lines" - "fd -ers -X cloc"
i: "install package" - "cargo install --path ."
}
menu git {
am: "amend staged" - "git commit --amend --no-edit"
aam: "amend all" - "git commit -a --amend --no-edit"
b: "git switch $(git branch | fzf)"
w: git_worktree
}
menu git_worktree {
a: cmd {
vars output_dir, branch
!"git worktree add -b "$branch" "$output_dir""!
}
l: "list" - "git worktree list"
p: "prune" - "git worktree prune"
}
menu misc {
s: "systemctl suspend"
mh: cmd{
vars file
"md2html" - !"
echo converting $file
pandoc "$file" -c ~/Sync/share/pandoc.css --toc --standalone \
--embed-resources -so "${file%.md}.html"
"!
}
th: cmd {
vars file, expected_hash
"test md5 hash" - !"
if [[ `md5sum $file | awk '{print $1}'` == $expected_hash ]]; then
echo 'success'
else
echo 'fail'; exit 1
fi
"!
}
r: cmd {
vars pattern, replacement
"grep replace" - !"
for f in $(rg "$pattern" -l); do
sed "s/$pattern/$replacement/g" -i $f
done
"!
}
x: cmd {
vars file
"extract" - !"7z x "$file" "-o${file}.d""!
}
p: cmd {
vars pat
"ps -e | grep -i $pat"
}
}