Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6668493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:02:51+00:00 2026-05-26T03:02:51+00:00

I know this question has been asked many times here and elsewhere before as

  • 0

I know this question has been asked many times here and elsewhere before as I am searching for the answer. However, it still puzzles me why the command line parser library doesn’t provide this common usage scenario, where I have a group of subcommands, each subcommand has its own set of required and optional arguments. Similar construct can be found in git/svn, though in their case, the subcommand command is a standalone program if I am not mistaken.

To summarize, what I am looking for is an easy way to:

top_command subcmd_A [ command A's options ....]
top_command subcmd_B [ command B's options ....]
...

In java’s world, two often mentioned library are Apache Command CLI and JSAP. I don’t see either of them have this in mind – though you could probably tweak and customize a lot to fit … but the basic flow of defining a option, register … then at the end, parse them all doesn’t seen to consider the case with different subcommands, the validation and parser need to behave in different way.

Maybe the common wisdom here is that this is too application specific and should be left to the application itself to handle. One way I can think of is to define a BaseCommand class, and each subcommand extends it and register themself … as a way to break it up for easy management. If any mature framework can do this, I’d appreciate any pointer here.

I could be wrong about my understanding of current parser capability though, any insight is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:02:52+00:00Added an answer on May 26, 2026 at 3:02 am

    Hi just take a look into jcommander which exactly supports the described scenario.
    You mentioned Commons CLI which is true in the releases 1.X but there exists a development for CLI2 which supports this as well, but unfortunately this release has never been published.

    Another good solution would be https://picocli.info/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question has been asked here a few times before. But i
I know that this question has been asked many times before in different guises
I know this question has been asked many times, but here are my specific
I know this question has been asked many times before but I can't find
I know this question has been asked so many times before but I couldn't
I know that this question has a been asked many times, but I still
I know this question has been asked many times on here but I have
I know this question has probably been asked so many times here, but I
I know this question has been asked alot of times, however most of them
I know this question has been asked many times, but my problem is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.