Add --side argument to filter list command (#256)

* added list command filter by side

* changed error logging for --side flags

* removed len checks on side flags

* removed comments previous commit made useless
This commit is contained in:
JaegyuDev
2023-09-16 12:26:10 -04:00
committed by GitHub
parent b451a9b034
commit 9889b48b0d
2 changed files with 26 additions and 4 deletions

View File

@@ -4,13 +4,14 @@ import (
"archive/zip"
"bufio"
"fmt"
"os"
"strconv"
"github.com/packwiz/packwiz/cmdshared"
"github.com/packwiz/packwiz/core"
"github.com/packwiz/packwiz/curseforge/packinterop"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"os"
"strconv"
)
// exportCmd represents the export command
@@ -20,8 +21,8 @@ var exportCmd = &cobra.Command{
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
side := viper.GetString("curseforge.export.side")
if len(side) == 0 || (side != core.UniversalSide && side != core.ServerSide && side != core.ClientSide) {
fmt.Println("Invalid side!")
if side != core.UniversalSide && side != core.ServerSide && side != core.ClientSide {
fmt.Printf("Invalid side %q, must be one of client, server, or both (default)\n", side)
os.Exit(1)
}