Skip to content

Adding additional CLI arguments #194

Answered by AbsoluteWisp
AbsoluteWisp asked this question in Q&A
Discussion options

You must be logged in to vote

OK, I'll answer to myself here because I figured it out and I think it could be useful to others:
In Minecraft's main function, define an OptionSpec (like the others, one under each other), like OptionSpec<String> myModArgument = optionparser.accepts("myArgumentName").withRequiredArg();. You can explore other methods available, like .withOptionalArg(), or use different types, like Files. Once you have that, go below the argument definitions and write code that uses your new shiny optionspec object called myModArgument, using parseArgument(optionSet, myModArgument). I have no idea why this took me so long, but that's literally it.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AbsoluteWisp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant