πŸ‹ Acho is a Swift library to generate interactive CLI prompts
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.github
.vscode
Sources
Tests/achoTests
assets
docs
.editorconfig
.gitignore
.jazzy.yaml
.prettierrc
.ruby-version
.swift-version
.swiftlint.yml
CHANGELOG.md
Dangerfile
Gemfile
Gemfile.lock
LICENSE.md
Package.resolved
Package.swift
README.md
RELEASE.md

README.md

πŸ‹ 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 Say Thanks! Join the community on Spectrum

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: "6.2.0")),
        ],
    targets: [
        .target(
            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)

gif

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!