Acho is a Swift library to generate interactive CLI prompts.
Where does acho come from? People from Murcia, the region where I'm from use acho a lot when speaking. It's a word that can be used for many things: grab someone's attention, ask or complain about something, tell someone not to do something anymore. Since I found a parallelism between one of the usages of the expression, and the goal of this library, asking the user for something, I thought it'd be the perfect name for the library.
Swift Package Manager
Add the dependency in your
let package = Package( name: "myproject", dependencies: [ .package(url: "https://github.com/tuist/acho.git", .upToNextMajor(from: "0.2.0")), ], targets: [ .target( name: "myproject", dependencies: ["acho"]), ] )
If you want to use Acho in a Marathon script, either add it to your
Marathonfile (see the Marathon repo for instructions on how to do that), or point Marathon to Acho using the inline dependency syntax:
import Acho // https://github.com/tuist/acho.git
Create an instance of
Acho passing the question and the options. The options need to conform both the protocol
let simulators = ["iPhone 10", "iPhone 7" ] let acho = Acho<String>() let simulator = acho.ask(question: "In which simulator would you like to run the app?", options: simulators)
Acho provides an
achoTesting target that you can use to easily stub the interaction with the public interface:
import achoTesting let mock = MockAcho<String>() let simulators = ["iPhone 10", "iPhone 7" ] mock.stub(question: "In which simulator would you like to run the app?", items: simulators, with: "iPhone 7")
Setup for development 👩💻
- Git clone:
- Generate Xcode project with
swift package generate-xcodeproj.
- Have fun 🤖
Tuist is a proud supporter of the Software Freedom Conservacy
Help us keep the lights on
0.3.0 - Apr 6, 2019
- Upgrade library for Swift 5 and drop support for Swift 4.2.1 by @pepibumur.
0.2.0 - Dec 24, 2018
- Limit the number of options to 6 https://github.com/tuist/acho/pull/2 by @pepibumur.
- Clear the output after selecting an option https://github.com/tuist/acho/pull/2 by @pepibumur.
- Cancel selection when pressing Q and ESC https://github.com/tuist/acho/pull/2 by @pepibumur.
0.1.0 - Dec 24, 2018
- First version of Acho :tada: