Reputation: 43
I'm building command line tools with swift and I'd like to make them more interactive to provide a better user experience.
I was wondering if it's possible to build a select menu for a command line tool similar to the one used in the firebase cli or the angular cli in swift. I'm using the swift argument parser at the moment and it would be very nice if the user could select from different options in a menu via the arrow keys and selecting with the space bar.
Firebase CLI option selection with firebase init
Upvotes: 4
Views: 456
Reputation: 48
As far as I know, this is not possible with swift-argument-parser at this monent. This was actually in the Summer of Code idea list for potential projects.
Swift ArgumentParser: Interactive mode
ArgumentParser provides a straightforward way to declare command-line interfaces in Swift, with the dual goals of making it (1) fast and easy to create (2) high-quality, user-friendly CLI tools. For this project, we would design and implement an interactive mode for tools built using ArgumentParser that prompts for any required arguments not given in the initial command. This work would need to allow partial initialization of types, and could include features like validation and auto-completion for user input.
https://www.swift.org/gsoc2021/
So I believe it might be implemented in the future.
Upvotes: 1