mirror of
https://github.com/packwiz/packwiz.git
synced 2025-11-18 17:14:32 +01:00
Initial command system
This commit is contained in:
57
main.go
Normal file
57
main.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package main
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/comp500/packwiz/core"
|
||||
"github.com/urfave/cli"
|
||||
|
||||
// Modules of packwiz
|
||||
_ "github.com/comp500/packwiz/curseforge"
|
||||
)
|
||||
|
||||
func init() {
|
||||
core.Commands = append(core.Commands, cli.Command{
|
||||
Name: "delete",
|
||||
Aliases: []string{"remove"},
|
||||
Usage: "Delete a mod from the modpack",
|
||||
Action: func(c *cli.Context) error {
|
||||
cmdDelete(core.FlagsFromContext(c))
|
||||
return nil
|
||||
},
|
||||
}, cli.Command{
|
||||
Name: "delet",
|
||||
Aliases: []string{"remov"},
|
||||
Usage: "Delete a mod from the modpack",
|
||||
Action: func(c *cli.Context) error {
|
||||
cmdDelete(core.FlagsFromContext(c))
|
||||
return nil
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Commands = core.Commands
|
||||
app.Flags = core.CLIFlags[:]
|
||||
app.HideVersion = true
|
||||
app.Usage = "A command line tool for creating Minecraft modpacks."
|
||||
|
||||
err := app.Run(os.Args)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func cmdDelete(flags core.Flags) {
|
||||
mod := "demagnetize"
|
||||
err := os.Remove(core.ResolveMod(mod, flags))
|
||||
if err != nil {
|
||||
fmt.Printf("Error removing mod: %s", err)
|
||||
} else {
|
||||
fmt.Printf("Mod %s removed successfully!", mod)
|
||||
}
|
||||
// TODO: update index
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user