forked from elkasztano/nushell-syntax-vim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.nu
More file actions
59 lines (44 loc) · 1.3 KB
/
uninstall.nu
File metadata and controls
59 lines (44 loc) · 1.3 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
# nushell syntax uninstall script
# use at your own risk
let system_os = (sys host).long_os_version
if ($system_os starts-with "Linux") {
let vimdir = $"($env.HOME)/.vim"
let filelist = [
$"($vimdir)/syntax/nu.vim",
$"($vimdir)/indent/nu.vim",
$"($vimdir)/ftdetect/nu.vim",
$"($vimdir)/ftplugin/nu.vim"
]
uninstall $vimdir $filelist
} else if ($system_os starts-with "Windows") {
let homedir = $"($env.HOMEDRIVE)($env.HOMEPATH)"
let vimdir = $"($homedir)\\vimfiles"
let filelist = [
$"($vimdir)\\syntax\\nu.vim",
$"($vimdir)\\indent\\nu.vim",
$"($vimdir)\\ftdetect\\nu.vim",
$"($vimdir)\\ftplugin\\nu.vim"
]
uninstall $vimdir $filelist
} else {
print $"(ansi -e '0;33;1m')currently only Linux or Windows systems supported(ansi -e '0m')"
print "please remove the files manually"
exit 1
}
def uninstall [vimdir, filelist] {
if not ( $vimdir | path exists ) {
print $"'($vimdir)' does not exist"
print "nothing to uninstall - exiting"
exit 0
}
$filelist | each {
|it|
if ( $it | path exists ) {
rm --interactive $it
} else {
print $"file (ansi -e '0;1m')'($it)'(ansi -e '0m') not found"
print "no file means nothing to remove\n"
}
}
}
print ""