-
Notifications
You must be signed in to change notification settings - Fork 25
/
install.fish
executable file
·111 lines (86 loc) · 2.64 KB
/
install.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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#! /usr/bin/fish
echo "
|_ _ _ _ _|
| |(_)(_|| (_|
command organizer
hoard setup - fish edition
https://github.com/hyde46/hoard
Please create an issue if you encounter any problems!
===============================================================================
"
function __hoard_install_with_cargo
if ! command -v cargo &> /dev/null
echo "cargo not found"
if command -v rustup &> /dev/null
echo "rustup was found, but cargo wasn't. Something is up with your installation."
exit 1
end
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q
echo "rustup installed!"
end
echo "Attempting to install hoard with cargo"
cargo install hoard-rs
end
function __hoard_install_ubuntu
set ARTIFACT_URL "https://github.com/hyde46/hoard/releases/download/v$LATEST_VERSION/hoard_$LATEST_VERSION.deb"
set TEMP_DEB (mktemp)
wget -O "$TEMP_DEB" "$ARTIFACT_URL"
sudo dpkg -i "$TEMP_DEB"
rm -f "$TEMP_DEB"
end
function __hoard_install_mac
echo "MacOS detected."
echo "Not yet supported, please install hoard from source with cargo"
end
function __hoard_detect_os
switch (uname)
case Linux
__hoard_install_ubuntu
case Darwin
__hoard_install_mac
case FreeBSD NetBSD DragonFly
echo "OS not supported yet. Please install from source with cargo"
case '*'
echo "OS not supported yet. Please install from source with cargo"
end
end
function extend_config
# Setup widget integration
echo 'hoard shell_config fish | source' >> ~/.config/fish/config.fish
echo 'source your fish.config and press <Ctrl-H> to get started with the interactive hoard UI'
end
function read_input
while true
echo "How do you wish to install hoard?"
echo "(1) From Source with cargo"
echo "(2) OS-Specific"
echo "(3) Not at all, bye"
read -l -P '> ' confirm
switch $confirm
case 1
__hoard_install_with_cargo
return 0
case 2
__hoard_detect_os
return 0
case '' 3
echo "Bye!"
return 1
end
end
end
function extend_fish_config
while true
read -l -P "Install fish plugin for autocomplete? This will extend your fish.config by a few lines [y/N] " confirm
switch $confirm
case Y y
extend_config
return 0
case '' N n
return 1
end
end
end
# Install hoard
read_input
extend_fish_config