Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommendation for Command Line Parser #4312

Closed
TheRealPiotrP opened this issue Oct 8, 2015 · 15 comments
Closed

Recommendation for Command Line Parser #4312

TheRealPiotrP opened this issue Oct 8, 2015 · 15 comments
Assignees
Labels
help wanted Issues that we would accept external contributions on. Also known as up-for-grabs.
Milestone

Comments

@TheRealPiotrP
Copy link
Contributor

Can someone make a recommendation on what CLI parser to use? some options:

  • ASP.NET
  • CoreFx
  • docopt
@Eilon
Copy link
Member

Eilon commented Oct 9, 2015

Do we need managed or unmanaged or both?

For managed code, DNX has one that is used in several utilities.

And it generates output like this:

C:\Users\elipton>dnu
Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-15798

Usage: dnu [options] [command]

Options:
  -v|--verbose  Show verbose output
  -?|-h|--help  Show help information
  --version     Show version information

Commands:
  build             Produce assemblies for the project in given directory
  clear-http-cache  Clears the package cache.
  commands          Commands related to managing application commands (install, uninstall)
  feeds             Commands related to managing package feeds currently in use
  install           Install the given dependency
  list              Print the dependencies of a given project
  pack              Build NuGet packages for the project in given directory
  packages          Commands related to managing local and remote packages folders
  publish           Publish application for deployment
  restore           Restore packages
  wrap              Wrap a csproj/assembly into a project.json, which can be referenced by project.json files

Use "dnu [command] --help" for more information about a command.

And:

C:\Users\elipton>dnu build --help


Usage: dnu build [arguments] [options]

Arguments:
  [projects]  One or more projects build. If not specified, the project in the current directory will be used.

Options:
  --framework <TARGET_FRAMEWORK>   A list of target frameworks to build.
  --configuration <CONFIGURATION>  A list of configurations to build.
  --out <OUTPUT_DIR>               Output directory
  --quiet                          Do not show output such as dependencies in use
  -?|-h|--help                     Show help information

@ahsonkhan
Copy link
Member

The above mentioned command line utility is what is currently being used.
Another alternative is the command line utility as part of corefx:
https://github.com/dotnet/corefxlab/tree/master/src/System.CommandLine

@KrzysztofCwalina
Copy link
Member

The corefxlab one does not use reflection, so [edit: might be] better for AOT

@Eilon
Copy link
Member

Eilon commented Oct 9, 2015

Hmm does the DNX one use reflection? I haven't dug into the code a whole lot but I didn't see any usage. Might have missed it.

@analogrelay
Copy link
Contributor

The DNX one doesn't use reflection either.

@bricelam
Copy link
Contributor

+1 for System.CommandLine; It's a lot like DNX's CommandLineUtils, but better in my opinion. 😈

@agocke
Copy link
Member

agocke commented Nov 17, 2015

System.CommandLine is already being used in dotnet-compile* -- I think it's worked pretty well. I hit issues with DNX command line since it's currently source-only and it also ties execution semantics of the program to command line parsing (i.e., app.Execute(args)).

@analogrelay
Copy link
Contributor

@bricelam SCANDAL! TRAITOR! HEATHEN! Nah, sounds good to me :). Let's move to System.CommandLine

@TheRealPiotrP
Copy link
Contributor Author

@krwq can you pick this up next?

@analogrelay
Copy link
Contributor

It seems we've been transitioning to System.CommandLine. Should we just get everything switched over and remove the DNX parser?

@davidfowl
Copy link
Member

Yes and fix the bugs in system.commandline

@Eilon
Copy link
Member

Eilon commented Dec 15, 2015

@davidfowl anything specific?

@davidfowl
Copy link
Member

Might just be a bug in run right now but you can't flow arguments to the application. i.e.

dotnet run --blag won't work

@TheBlueSky
Copy link

Now that dotnet is going to use System.CommandLine, is it safe to assume that System.CommandLine will make it to corefx repository?

@blackdwarf
Copy link

Guys, since we have started using the System.CommandLine, I will close this issue. Please reopen if needed.

/cc @piotrpMSFT

wli3 referenced this issue in wli3/cli Jul 14, 2017
Initial implementation of the Publish target.
@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@msftgits msftgits added this to the 1.0.0-rc2 milestone Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues that we would accept external contributions on. Also known as up-for-grabs.
Projects
None yet
Development

No branches or pull requests