-
Notifications
You must be signed in to change notification settings - Fork 1
/
J.fish
52 lines (42 loc) · 1.14 KB
/
J.fish
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
function J -d "jujutsu launcher"
# !i -> --ignore-immutable
# !b -> --allow-backwards
# !p -> --no-pager
# !ae -> --reset-author --no-edit
#
# TODO: unify with vyxnix somehow?
# Specify --vyx-dry-run to echo the command that would be executed.
set -f dryrun 0
# $args: arguments passed to the command
set -f args
for arg in $argv
if test "$arg" = --vyx-dry-run
set dryrun 1
continue
end
if test "$arg" = "!i"
set -a args --ignore-immutable
continue
end
if test "$arg" = "!b"
set -a args --allow-backwards
continue
end
if test "$arg" = "!p"
set -a args --no-pager
continue
end
if test "$arg" = "!ae"
set -a args --reset-author --no-edit
continue
end
set -a args $arg
end
if test "$dryrun" -eq 1
echo command jj (string escape -- $args)
else
command jj $args
end
end
complete -c J -l vyx-dry-run -d "do a dry run of this command; i.e. echo what would be run"
complete -c J -w jj