Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Today, I researched a way for handling helper scripts for my Mac application. I tested all three major players (swift-sh, Marathon, Beak) and I like the approach of swift-sh the most. Especially the shebang and the idea of editing out into Xcode while working on the script without having to maintain the Xcode project afterwards.
Unfortunately, there have been also two issues which bother me a bit. The first one being the management of the Homebrew formula which I described in mxcl/homebrew-made#4. The second one is the inability to get the autocompleting in Xcode working.
Here are the steps I've performed. First, I installed the tool from source (version 1.12.0):
$ git clone https://github.com/mxcl/swift-sh.git $ cd swift-sh $ swift build -c release $ cp .build/ $ cp .build/release/swift-sh "/Applications/Xcode 10.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/" $ cp .build/release/swift-sh-edit "/Applications/Xcode 10.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
Then I created a sample script from the README:
$ cat <<EOF > script #!/usr/bin/swift sh import PromiseKit // @mxcl ~> 6.5 print(Promise.value("Hi!")) EOF $ chmod u+x script $ ./script # => Promise("Hi!")
So far everything worked smoothly, so I tried to edit the script in Xcode 10.2 using
@mxcl I must be missing something. Could you please give me a hint regarding what I'm doing wrong?
Here are more thoughts about this issue and the edit command implementation. I just learnt that there was a big change in the behavior which went from the standard Xcode project generated via
While going through other tools today, I stumbled upon the way Marathon handles this. After executing the edit command, the Xcode project generated via SPM gets opened but the command is waiting. After performing the change the command is terminated which apparently copies the changed file to its original location. Wouldn't this be a nicer approach?
EDIT: This is the routine in the Marathon codebase I'm referring to.
I would not like this approach no. I need my terminal to be useful, not waiting for things, not to mention there are numerous ways you could lose work because the terminal command is killed while you continue to edit.
Honestly, I think it's a really terrible approach.