Skip to content

Commit

Permalink
Add flags for handling of optional mods
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed Feb 12, 2025
1 parent 96bfe09 commit 436e14e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ Examples:
mrpack-install server paper --minecraft-version 1.18.2 --server-file srv.jar
Flags:
--flavor-version string Flavor version (default "latest")
-h, --help help for server
--minecraft-version string Minecraft version (default "latest")
--flavor-version string Flavor version (default "latest")
-h, --help help for server
--minecraft-version string Minecraft version (default "latest")
--optional-disable-all Disable all optional mods
--optional-select stringArray Select optional mods by id
Global Flags:
--dl-retries uint8 Retries when download fails (default 3)
Expand Down
9 changes: 9 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ var (
dlRetries uint8
)

var (
// local options
optionalModsSelected []string
optionalModsDisableAll bool
)

func init() {
var printVersion bool
RootCmd.Flags().BoolVarP(&printVersion, "version", "V", false, "Print version and exit")
Expand All @@ -46,6 +52,9 @@ func init() {
RootCmd.PersistentFlags().Uint8Var(&dlThreads, "dl-threads", 8, "Concurrent download threads")
RootCmd.PersistentFlags().Uint8Var(&dlRetries, "dl-retries", 3, "Retries when download fails")

serverCmd.Flags().StringArray("optional-select", optionalModsSelected, "Select optional mods by id")
serverCmd.Flags().BoolVar(&optionalModsDisableAll, "optional-disable-all", false, "Disable all optional mods")

cobra.OnInitialize(func() {
if printVersion {
buildinfo.Print()
Expand Down

0 comments on commit 436e14e

Please # to comment.