dotnet / dotnet/command-line-api

Argument Groups

Open
#1,986 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

I have an interesting problem I'd like to throw into the mix.

I'm working on choosing a new command line handler implementation for an existing application. This existing application supports (and requires some notion of) nested option sets. The idea here is that the command line tool is used for doing an operation. And that it can be told to do this operation multiple times with different options. For instance, compile file A to file B. But then also compile file C to D. And E to F. At the same time. With overlapping global options but also independent group options.

The usage might look like this: ikvmc.exe -assembly:out.dll -baseaddress 0x00000000 inputfile.jar -reference C:\Foo\Bar.dll

But the user might want to compile multiple JARs into a single assembly:

ikvmc.exe -assembly:out.dll -baseaddress 0x00000000 inputfile1.jar inputfile2.jar -reference C:\Foo\Bar.dll

And the grouping: the user might want to compile multiple JARs into multiple assemblies.

ikvmc.exe -reference c:\foo\bar.dll { -assembly:out1.dll -baseaddress 0x00000000 inputfile1.jar } { -assembly:out2.dll -baseaddress 0x00000000 inputfile2.jar }

See?

The idea here is options can be made global (-reference), but other options can be nested into levels. A pattern like this is required for the tool, as various interesting operations can be done to actually tie the independant operations together such as putting -assembly at the top level, etc).

I don't really expect System.CommandLine to support something like this out of the box. But it would be interesting to get ideas about whether I can make it accomplish this with some custom code.

For anybody familiar, GStreamer has a similar notion.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.