Questions tagged [jcommander]

A java utility for CLI parameters parsing.

A java utility for CLI parameters parsing.

See http://jcommander.org/ for full details.

40 questions
19
votes
2 answers

How to print help using jcommander?

How to print help using jcommander? I couldn't find an API for this.
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
6
votes
2 answers

Pass an argument that starts with '@' to jcommander

I am using JCommander(version 1.32) to parse command line arguments passed to a java application(let's call it app). The problem I have is that one of the arguments I need to pass begins with @ and as can be seen here there is a special syntax for…
Ivaylo Strandjev
  • 69,226
  • 18
  • 123
  • 176
5
votes
1 answer

How to execute the parsed command with jcommander?

I'm using JCommander to interact with the user on the command line. The JCommander setup looks like the following: JCommander jCommander = new JCommander(); jCommander.addCommand(new Command1()); jCommander.addCommand(new…
SpaceTrucker
  • 13,377
  • 6
  • 60
  • 99
4
votes
2 answers

How to add command line parameter dependency using JCommander?

I am using JCommander for command line parameters parsing. I would like to add parameter dependency, but from the JCommander documentation, I am not able to find out if it is even supported. Has anyone tried it ? For example, java -jar Some.jar -a…
Arjun Patel
  • 345
  • 6
  • 22
3
votes
1 answer

jCommander - Next Parameter is considered as a value

I have a problem with the JCommander. I want the program to throw an Exception, if the required parameter iam testing has no value. This Exception i want occurs when i forget to add a value to the last parameter. Example(note: all Parameters are…
leif_good
  • 376
  • 6
  • 19
3
votes
3 answers

How to install JCommander and use it in my program?

I am doing one project and I want to use JCommander for parsing command line input. But I don't know how to add it to my machine and use it. Here is the GitHub page for JCommander. So how can I add it to my machine after downloading zip file of…
Pratik
  • 88
  • 1
  • 2
  • 11
3
votes
1 answer

Argument option using JCommander

I'm new with JCommander and I'm trying to use it in my JAVA Command Line Application. Fisrt thing I did is I've created my CommandLineArguments class. Now, I'm trying to print options given with arguments in command line. But I think I'm missing…
Ismail Sen
  • 571
  • 2
  • 14
  • 27
2
votes
0 answers

How to define parameter with arity 0 or 1

I'm using jcommander 1.72 to handle commands in a REPL (not directly from the command line). I have a parameter that can optionally take a value; if a value is provided, the value is set. If no value is provided, then the current value is printed.…
marinier
  • 387
  • 3
  • 13
2
votes
1 answer

JCommander validate list item

I'm using JCommander v. 1.72 and my aim is to get a (comma-seperated) list of strings in a parameter and validate the single strings. Sounds simple, right? Here is my code: @Parameter(names = { "-sort", "-s" }, validateWith =…
Erich13
  • 69
  • 5
2
votes
2 answers

node.js command line programs(using commander node-module) opens index.js on execution

I am using commander@2.9.0. Attached the code below package.json { "name": "commandtools", "version": "1.0.0", "description": "A command line example", "main": "index.js", "scripts": { "test": "node index.js hello" }, …
Muthu
  • 337
  • 6
  • 19
2
votes
0 answers

Interpret multiple 'command' style arguments

JCommander has a nice feature that it refers to as commands. The example they give looks like this: git commit --amend -m "Bug fix" Is it possible to configure JCommander (or any other command line parser), to accept multiple commands? For…
Fidel
  • 7,027
  • 11
  • 57
  • 81
1
vote
1 answer

JCommander select only one parameter of a set

I was trying to obtain the following command line configuration: myprogram.jar --op1 --other parameters OK myprogram.jar --other parameters --op2 OK myprogram.jar --op1 --op2 should launch ParameterException I don't want to set…
alexHX12
  • 403
  • 2
  • 9
1
vote
0 answers

Is it possible to parse command line arguments in JCommander without giving the name to argument?

If I would like to run my app like this: java -jar target/App.jar 1928 start or java -jar target/App.jar 1928 start -d 3, So how can I parse first two parameters, which would have no name, only values? class Args { @Parameter(names = "") …
1
vote
1 answer

How to get the input order of parameters in JCommander?

How can I get the input order of parameters in JCommander? I want to know which parameter was input first. For example Myapp --cut -- reverse Myapp --reverse -- cut Is this possible in Jcommander? And if so, how?
sensn
  • 15
  • 5
1
vote
1 answer

SpringBoot CLI properties with jCommander

I am using JCommander API for a Spring Boot - Spring Batch project. Project has multiple jobs and I need to pass job name as parameter so I can launch specific jobs . java -jar myJar.jar -jobName job1 Now, if my job1 is running and I wish to…
Sabir Khan
  • 9,826
  • 7
  • 45
  • 98
1
2 3