Swiftpack.co - Package - tuist/acho

🍋 acho

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.

CircleCI Swift Package Manager Release Code Coverage Slack License

Install 🛠

Swift Package Manager

Add the dependency in your Package.swift file:

let package = Package(
    name: "myproject",
    dependencies: [
        .package(url: "https://github.com/tuist/acho.git", .upToNextMajor(from: "0.2.0")),
    targets: [
            name: "myproject",
            dependencies: ["acho"]),

Using Marathon

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

Usage 🚀

Create an instance of Acho passing the question and the options. The options need to conform both the protocol CustomStringConvertible and Hashable:

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)


Testing ✅

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 👩‍💻

  1. Git clone: git@github.com:tuist/acho.git
  2. Generate Xcode project with swift package generate-xcodeproj.
  3. Open acho.xcodeproj.
  4. Have fun 🤖

Open source

Tuist is a proud supporter of the Software Freedom Conservacy

Become a Conservancy Supporter!


Stars: 30
Help us keep the lights on


Used By

Total: 0


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: