var name: String?
print("What is the name?")
if let input = readLine() {
name = input
}
if let name = name {
print("You input: \(name)")
}
I have a command-line application where the user is asked to input a name that may contain colons. In the macOS zsh terminal, when the user inputs a colon, it autocompletes to what looks like a dictionary:
acidgate % What is the name? // prompt user for input
acidgate % [Acid Gate: 2020] // the user's input is autocompleted with brackets
This is what I want it to look like:
acidgate % What is the name?
acidgate % Acid Gate: 2020 // no autocomplete
If I can disable this autocomplete in my application, that would be ideal. If not, how do I handle the response? Because if the user manually deletes the brackets after they are autocompleted for him, the string has weird artifacting:
You input: Acid Gate: 2020� // printing the user's input
However, if the user doesn't remove the square brackets and inputs [Acid Gate: 2020], the print console appears to show a clean string:
You input: Acid Gate: 2020