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

Advice for users of the argument parser in swift-tools-support-core ? #5

Closed
gavineadie opened this issue Feb 28, 2020 · 7 comments
Closed

Comments

@gavineadie
Copy link

Swift Package Manager incorporates a stand-alone 'swift-tools-support-core' which provides an argument parser which seems to have a very similar feature set to 'swift-argument-parser' (and, incidentally, includes bash/zsh command completion), and some web tutorials have described the use of this component for command line tools.

Would those in the know, recommended that using 'swift-argument-parser' is a better choice over the argument parser in 'swift-tools-support-core' for any new work and that, maybe, even existing use of the 'swift-tools-support-core' argument parser should be curtailed and migrated to the new library?

I do appreciate that neither option is a finished work, that the world changes, and that any such advice should depend on the specific case in question. One specific case that would cast light on this is SwiftPM itself .. is 'swift-ap' expected to replace the current argument parsing done by 'swift-tsc' in SwiftPM (the Swift blog describes increasing incorporation of 'swift-ap' in various parts of the Swift Project)?

@zntfdr
Copy link
Contributor

zntfdr commented Feb 28, 2020

Reading the Swift blog announcement, I believe it's safe to say that swift-tools-support-core's TSCUtility ArgumentParser is going to be replaced by this new library.

Therefore I suggest any new and current project to migrate-to/use swift-argument-parser 👍

@gavineadie
Copy link
Author

I switched TSCUtility usage in one of my commands to ArgumentParser and must say it's much, much nicer to use! Sad to lose some other command line utilities in TSCUtility but they might migrate .. fairly minor stuff related to standard i/o, and a nice <<< operator.

@artemnovichkov
Copy link
Contributor

I've tried to migrate Carting and it was surprisingly easy! The biggest pro for me is reusing arguments for different commands. You can check my changes here.

@aciidgh
Copy link
Member

aciidgh commented Feb 28, 2020

The argument parser in swift-tools-support-core was written in 2016 for Swift build tools like SwiftPM and LLBuild. It served SwiftPM for many years but I've been hoping to improve the API as it doesn't scale very well when you have large number of subcommands and flag. This new parser has a much much nicer API. My hope is that we can adopt the new argument parser in SwiftPM and kill the one in swift-tools-support-core.

@gavineadie
Copy link
Author

If you will excuse chatter from someone who's been programming for fifty+ years, I really like this library. When us graybeards talk over a beer about 'modern' programming, we tend to claim that there's little new in our business; it's mostly re-cycled. But, I think Swift is driving us into new paradigms and ArgumentParser is a good example .. or, maybe, I'm just old! Kudos, anyway!

@kaandedeoglu
Copy link

I've also done the transition for my library in this PR. Took me about an hour - really amazing work by everyone involved!!

@natecook1000
Copy link
Member

So happy to see the enthusiasm here! If there's more to continue in this conversation, let's take it up in the ArgumentParser forum section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants