-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
79 lines (63 loc) · 2.42 KB
/
Copy pathJustfile
File metadata and controls
79 lines (63 loc) · 2.42 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
set shell := ["fish", "-c"]
list_file := "formulae-list.json"
# generate all lists
@default:
just generate-list > /dev/null
just generate-cask-list > /dev/null
just generate-crate-list
# generate installed homebrew formulae list json file
@generate-list: && preview
brew leaves | xargs brew info --json | \
jq '[.[]|{"name", "desc", "homepage", "tap", "caveats", "linked_keg"}]' > {{list_file}}
# install all formulae in the list file
@install-all:
jq '.[]|.["name"]' {{list_file}} | xargs brew install
# install formulae interactively
install:
comm -13i (brew leaves | psub) (jq -r '.[]."name"' {{list_file}} | psub) | \
fzf -m --bind 'alt-a:select-all,alt-d:deselect-all' | \
xargs brew install
# preview changes
@preview:
set -e IFS; set MSG (./scripts/list-diff.py); test -z "$MSG" && echo "Nothing changes" || echo "$MSG"
# commit & push formulae changes
push-changes:
#!/usr/bin/env fish
set -e IFS
set MSG (./scripts/list-diff.py)
if test -z $MSG
echo "Nothing to commit"
exit 0
end
set DS (date +'%Y-%m-%d %H:%M:%S')
set HEADLINE "Updates ($DS)"
set COMMIT_MSG """$HEADLINE
$MSG
"""
git commit -am "$COMMIT_MSG"
git push
# generate installed casks list json file
@generate-cask-list: && preview
brew list --cask | xargs brew info --cask --json=v2 | \
jq '[."casks"|.[]|{token,full_token,name:.name[0],homepage,desc,caveats,installed}]' > installed-casks.json
# install all casks in the list file
@cask-install-all:
jq '.[]|.["token"]' installed-casks.json | xargs brew install --cask
# install casks interactively
@cask-install:
jq -r '.[]|{"token", "installed"} | "\(.token) \(.installed)"' installed-casks.json | \
fzf -m --bind 'alt-a:select-all,alt-d:deselect-all' | \
cut -d' ' -f1 | xargs brew install --cask
# generate installed rust crates list json file
@generate-crate-list: && preview
cargo install --list | grep -E '^\w' | tr -d ':' > installed-crates-bins.txt
# install all crates in the list file
@crate-install-all:
cat installed-crates-bins.txt | cut -d ' ' -f1 | xargs cargo install
# install crates interactively
@crate-install:
cat installed-crates-bins.txt | fzf -m --bind 'alt-a:select-all,alt-d:deselect-all' | \
cut -d ' ' -f1 | xargs cargo install
# upgrade all installed crate binaries
@crate-upgrade-all:
cargo install --list | grep -E '^\w' | cut -d ' ' -f1 | xargs cargo install