Add --output/-o flags for Modrinth/Curseforge export (fixes #38)

This commit is contained in:
comp500
2022-02-27 17:44:44 +00:00
parent 2dd0a1ae78
commit 7c387f6c83
2 changed files with 12 additions and 2 deletions

View File

@@ -56,7 +56,10 @@ var exportCmd = &cobra.Command{
mods := loadMods(index)
var fileName = pack.GetPackName() + ".mrpack"
fileName := viper.GetString("modrinth.export.output")
if fileName == "" {
fileName = pack.GetPackName() + ".mrpack"
}
expFile, err := os.Create(fileName)
if err != nil {
fmt.Printf("Failed to create zip: %s\n", err.Error())
@@ -251,4 +254,6 @@ func loadMods(index core.Index) []core.Mod {
func init() {
modrinthCmd.AddCommand(exportCmd)
exportCmd.Flags().StringP("output", "o", "", "The file to export the modpack to")
_ = viper.BindPFlag("modrinth.export.output", exportCmd.Flags().Lookup("output"))
}