mirror of
https://github.com/packwiz/packwiz.git
synced 2025-05-02 18:46:31 +02:00
Add --output/-o flags for Modrinth/Curseforge export (fixes #38)
This commit is contained in:
parent
2dd0a1ae78
commit
7c387f6c83
@ -84,7 +84,10 @@ var exportCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileName = pack.GetPackName() + ".zip"
|
fileName := viper.GetString("curseforge.export.output")
|
||||||
|
if fileName == "" {
|
||||||
|
fileName = pack.GetPackName() + ".zip"
|
||||||
|
}
|
||||||
|
|
||||||
expFile, err := os.Create(fileName)
|
expFile, err := os.Create(fileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -260,4 +263,6 @@ func init() {
|
|||||||
|
|
||||||
exportCmd.Flags().StringP("side", "s", "client", "The side to export mods with")
|
exportCmd.Flags().StringP("side", "s", "client", "The side to export mods with")
|
||||||
_ = viper.BindPFlag("curseforge.export.side", exportCmd.Flags().Lookup("side"))
|
_ = viper.BindPFlag("curseforge.export.side", exportCmd.Flags().Lookup("side"))
|
||||||
|
exportCmd.Flags().StringP("output", "o", "", "The file to export the modpack to")
|
||||||
|
_ = viper.BindPFlag("curseforge.export.output", exportCmd.Flags().Lookup("output"))
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,10 @@ var exportCmd = &cobra.Command{
|
|||||||
|
|
||||||
mods := loadMods(index)
|
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)
|
expFile, err := os.Create(fileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Failed to create zip: %s\n", err.Error())
|
fmt.Printf("Failed to create zip: %s\n", err.Error())
|
||||||
@ -251,4 +254,6 @@ func loadMods(index core.Index) []core.Mod {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
modrinthCmd.AddCommand(exportCmd)
|
modrinthCmd.AddCommand(exportCmd)
|
||||||
|
exportCmd.Flags().StringP("output", "o", "", "The file to export the modpack to")
|
||||||
|
_ = viper.BindPFlag("modrinth.export.output", exportCmd.Flags().Lookup("output"))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user