-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathl.nu
More file actions
executable file
·63 lines (55 loc) · 1.06 KB
/
l.nu
File metadata and controls
executable file
·63 lines (55 loc) · 1.06 KB
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
#!/usr/bin/env nu
# completion for l
#def "nu-complete l" [] {
# [[value description]; [boo scarry] [yikes alert]]
#}
# ls grid that shows git status modified with a red *
def "l" [
# command?: string@"nu-complete l"
--help
] {
let gs = ^git status | complete
let isgitrepo = $gs.exit_code == 0
if $isgitrepo {
let modified = (
$gs.stdout | lines
| parse "{x}modified:{modified}"
| reject x
| str trim
| get modified
)
ls -a
| upsert m {|f| if $f.name in $modified {$"(ansi red)*(ansi reset)"}}
| rename --column {name: fname}
| upsert name {|f| $"($f.fname)($f.m)"}
| grid -c
} else {
ls -a | grid -c
}
}
# gist list grid
def gl [] {
gh gist list | get description | grid
}
# list gist grid
def lg [] {
gl
}
# list repos grid
def lr [] {
gh repo list | get name | grid
}
# repos list grid
def rl [] {
lr
}
# keybindings grid
def kbg [] {
$env.config.keybindings
| sort-by modifier
| upsert name {|r| $"($r.modifier) ($r.keycode) ($r.name)"}
| grid
}
def main [] {
l
}