Skip to content

Commit a2fb892

Browse files
committed
add uninstall command + aliases for existing commands
1 parent 40fc49c commit a2fb892

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/func/func.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ func Install(args []string) {
5454
}
5555
}
5656

57+
func Uninstall(args []string) {
58+
if len(args) != 1 {
59+
fmt.Println("flight uninstall <pkg>")
60+
} else {
61+
os.RemoveAll(fmt.Sprintf("./node_modules/%v", args[0]))
62+
}
63+
}
64+
5765
func Figlet() {
5866
// Open the file.
5967
f, _ := os.Open("..\\misc\\flight.txt")

src/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ func main() {
1212
if len(cli) == 0 {
1313
fmt.Println("flight <command> [arguments]")
1414
} else {
15-
if cli[0] == "help" {
15+
if cli[0] == "-h" {
1616
funcs.Help()
17-
} else if cli[0] == "install" {
17+
} else if cli[0] == "install" || cli[0] == "i" || cli[0] == "add" || cli[0] == "a" || cli[0] == "get" || cli[0] == "g" {
1818
funcs.Install(cli[1:])
19+
} else if cli[0] == "uninstall" || cli[0] == "u" || cli[0] == "remove" || cli[0] == "r" || cli[0] == "ui" {
20+
funcs.Uninstall(cli[1:])
1921
} else {
2022
fmt.Println("flight <command> [arguments]")
2123
}

0 commit comments

Comments
 (0)