Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Last active December 23, 2020 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sturdysturge/080864e190e066630811ef741b88e464 to your computer and use it in GitHub Desktop.
Save sturdysturge/080864e190e066630811ef741b88e464 to your computer and use it in GitHub Desktop.
Command Line Tool that prints passed arguments
import Foundation
print("Launch arguments:")
var arguments = CommandLine.arguments
if arguments.count > 0 {
print("Launch arguments:")
for argument in arguments {print(argument)}
}
print("This tool keeps repeating your input until your input is the word quit")
var inputString = String()
while inputString != "quit"
{
inputString = readLine()!
print("You said: \(inputString)")
}
print("The program has ended")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment