Skip to content
/ swish Public

Portable and composable Swift-based automation

Notifications You must be signed in to change notification settings

tuist/swish

Repository files navigation

Swish

Swish

swish is a simple yet powerful command-line tool to automate in Swift. It's designed to make scripts lightweight, portable, and easy to edit and run.

Usage

Install Swish using Mise:

mise use -g ubi:tuist/swish@latest

And then us it directly:

swish ./path/to/script.swift

Or through the shebang of the script Swift file ./path/to/script.swift:

#!/usr/bin/env swish

struct Script {
  static func main() async throws {
    print("Hello world")
  }
}

#if SWISH_MAIN
  await Script.main()
#endif

Important

Swish files can be both, executable and libraries. Therefore, you should follow two important conventions:

  1. Wrap the executable logic using the SWISH_MAIN compiler directive.
  2. Namespace the business logic using a struct with a unique name.

About

Portable and composable Swift-based automation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published