mirror of
https://github.com/packwiz/packwiz.git
synced 2025-10-15 07:24:32 +02:00
Reword "mod"/"addon"/"install" to clearer terms across all commands (fixes #138)
This commit is contained in:
@@ -11,14 +11,10 @@ import (
|
||||
// removeCmd represents the remove command
|
||||
var removeCmd = &cobra.Command{
|
||||
Use: "remove",
|
||||
Short: "Remove a mod from the modpack",
|
||||
Short: "Remove an external file from the modpack; equivalent to manually removing the file and running packwiz refresh",
|
||||
Aliases: []string{"delete", "uninstall", "rm"},
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args[0]) == 0 {
|
||||
fmt.Println("You must specify a mod.")
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println("Loading modpack...")
|
||||
pack, err := core.LoadPack()
|
||||
if err != nil {
|
||||
@@ -32,7 +28,7 @@ var removeCmd = &cobra.Command{
|
||||
}
|
||||
resolvedMod, ok := index.FindMod(args[0])
|
||||
if !ok {
|
||||
fmt.Println("You don't have this mod installed.")
|
||||
fmt.Println("Can't find this file; please ensure you have run packwiz refresh and use the name of the .pw.toml file (defaults to the project slug)")
|
||||
os.Exit(1)
|
||||
}
|
||||
err = os.Remove(resolvedMod)
|
||||
@@ -40,7 +36,7 @@ var removeCmd = &cobra.Command{
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println("Removing mod from index...")
|
||||
fmt.Println("Removing file from index...")
|
||||
err = index.RemoveFile(resolvedMod)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
@@ -62,7 +58,7 @@ var removeCmd = &cobra.Command{
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Printf("Mod %s removed successfully!\n", args[0])
|
||||
fmt.Printf("%s removed successfully!\n", args[0])
|
||||
},
|
||||
}
|
||||
|
||||
|
@@ -11,13 +11,13 @@ import (
|
||||
|
||||
// updateCmd represents the update command
|
||||
var updateCmd = &cobra.Command{
|
||||
Use: "update [mod]",
|
||||
Short: "Update a mod (or all mods) in the modpack",
|
||||
Use: "update [name]",
|
||||
Short: "Update an external file (or all external files) in the modpack",
|
||||
Aliases: []string{"upgrade"},
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// TODO: --check flag?
|
||||
// TODO: specify multiple mods to update at once?
|
||||
// TODO: specify multiple files to update at once?
|
||||
|
||||
fmt.Println("Loading modpack...")
|
||||
pack, err := core.LoadPack()
|
||||
@@ -39,11 +39,11 @@ var updateCmd = &cobra.Command{
|
||||
var singleUpdatedName string
|
||||
if viper.GetBool("update.all") {
|
||||
updaterMap := make(map[string][]core.Mod)
|
||||
fmt.Println("Reading mod files...")
|
||||
fmt.Println("Reading metadata files...")
|
||||
for _, v := range index.GetAllMods() {
|
||||
modData, err := core.LoadMod(v)
|
||||
if err != nil {
|
||||
fmt.Printf("Error reading mod file: %s\n", err.Error())
|
||||
fmt.Printf("Error reading metadata file: %s\n", err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ var updateCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
if !updatesFound {
|
||||
fmt.Println("All mods are up to date!")
|
||||
fmt.Println("All files are up to date!")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -126,12 +126,12 @@ var updateCmd = &cobra.Command{
|
||||
}
|
||||
} else {
|
||||
if len(args) < 1 || len(args[0]) == 0 {
|
||||
fmt.Println("Must specify a valid mod, or use the --all flag!")
|
||||
fmt.Println("Must specify a valid file, or use the --all flag!")
|
||||
os.Exit(1)
|
||||
}
|
||||
modPath, ok := index.FindMod(args[0])
|
||||
if !ok {
|
||||
fmt.Println("You don't have this mod installed.")
|
||||
fmt.Println("Can't find this file; please ensure you have run packwiz refresh and use the name of the .pw.toml file (defaults to the project slug)")
|
||||
os.Exit(1)
|
||||
}
|
||||
modData, err := core.LoadMod(modPath)
|
||||
@@ -207,7 +207,7 @@ var updateCmd = &cobra.Command{
|
||||
os.Exit(1)
|
||||
}
|
||||
if viper.GetBool("update.all") {
|
||||
fmt.Println("Mods updated!")
|
||||
fmt.Println("Files updated!")
|
||||
} else {
|
||||
fmt.Printf("\"%s\" updated!\n", singleUpdatedName)
|
||||
}
|
||||
@@ -217,6 +217,6 @@ var updateCmd = &cobra.Command{
|
||||
func init() {
|
||||
rootCmd.AddCommand(updateCmd)
|
||||
|
||||
updateCmd.Flags().BoolP("all", "a", false, "Update all mods")
|
||||
updateCmd.Flags().BoolP("all", "a", false, "Update all external files")
|
||||
_ = viper.BindPFlag("update.all", updateCmd.Flags().Lookup("all"))
|
||||
}
|
||||
|
Reference in New Issue
Block a user