mxcl / swift-sh

Easily script with third-party Swift dependencies.
The Unlicense
1.8k stars 59 forks source link

Hyphen or Space? #195

Open jradxl opened 2 months ago

jradxl commented 2 months ago

I'm coming from Linux experience and have been investigating whether I can use Swiftlang for general scripting instead of Bash. I came across this repo, but the documentation is very confusing as you write "swift sh" in most places.

I'm using 5.10.1, and swift-sh builds without issue. I copy .build/debug/swift-sh to /usr/local/bin as I would expect

I then use the Promise Example as follows:

$ cat script 
#!/usr/bin/env swift-sh
import PromiseKit  // @mxcl ~> 6.5
print(Promise.value("Hi!"))

Please note I use "swift-sh" as based on my Linux experience, "swift sh" does not work. My script above works fine, and I am very impressed.

Are these "swift sh" un-noticed typos, or is there something else I should know.

mxcl commented 1 month ago

swift is a launcher. swift foo will cause swift to search for swift-foo in the PATH and launch that if it finds it. So both work. Sorry if the docs are confusing.