Skip to content

Instantly share code, notes, and snippets.

@JohnSundell
Created August 25, 2018 18:14
Show Gist options
  • Save JohnSundell/6f372850dc763cb5960fe45b91abd646 to your computer and use it in GitHub Desktop.
Save JohnSundell/6f372850dc763cb5960fe45b91abd646 to your computer and use it in GitHub Desktop.
A script that makes it easier to use the Swift Package Manager by making common commands less verbose πŸ‘
#!/usr/bin/env bash
# Put this file in /usr/local/bin and then run chmod +x on it to make it executable
command=$1
shift
case $command in
"init" )
swift package init "$@"
;;
"init-cli" )
swift package init --type executable
;;
"update" )
swift package update "$@"
;;
"build" )
swift build "$@"
;;
"test" )
swift test "$@"
;;
"run" )
swift run "$@"
;;
"install" )
PACKAGE=${PWD##*/}
swift build -c release -Xswiftc -static-stdlib
install .build/Release/$PACKAGE /usr/local/bin/$PACKAGE
;;
"manifest" )
open Package.swift
;;
"xcode" )
swift package generate-xcodeproj "$@"
open *.xcodeproj
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment