GitXplorerGitXplorer
h

Shell

public
109 stars
7 forks
0 issues

Commits

List of commits on branch master.
Unverified
37b8446aa7291576663838deea9396bb93adb464

Link to blogpost

hhelje5 committed 6 years ago
Verified
9a57b8b76ddd76c8146e22a1edd673c39052e9f3

Merge pull request #1 from BalestraPatrick/patch-1

hhelje5 committed 6 years ago
Verified
215b9b71e1d27691e435155c2dce18313fb662db

Add Swift syntax highlighting

BBalestraPatrick committed 6 years ago
Unverified
6fd94bcc2b2364780cd3bd19a38ae68688704c50

Improve README

hhelje5 committed 6 years ago
Unverified
9982634c51b506d42fcb11b1c85e7ccc145679bd

Improve tests

hhelje5 committed 6 years ago
Unverified
d81e0cca3ac1f5ef4a1552fe5b392b01a388f4d4

Yet another 10.11 PATH processing fix

hhelje5 committed 6 years ago

README

The README file for this repository.

Shell

Swift5 macOS

Module exposing Unix command line tools as Swift 5 @dynamicCallable functions

A few words of warning: This is intended as a demo. It should work just fine, but in the name of error handling and proper Swift beauty, you might want to approach forking processes differently 🤓 (BTW: PRs are welcome!)

Part of this blog post: @dynamicCallable: Unix Tools as Swift Functions.

Sample tool

The regular Swift Package Manager setup process:

mkdir ShellConsumerTest && cd ShellConsumerTest
swift package init --type executable

Sample main.swift:

import Shell

print(shell.host("zeezide.de"))

Sample Package.swift:

// swift-tools-version:5.0

import PackageDescription

let package = Package(
    name: "ShellConsumerTest",
    dependencies: [
        .package(url: "https://github.com/AlwaysRightInstitute/Shell.git",
                 from: "0.1.0"),
    ],
    targets: [
        .target(name: "ShellConsumerTest", dependencies: [ "Shell" ]),
    ]
)

Remember to add the dependency in two places. WET is best!

swift run and swift test patch the $PATH to just /usr/bin. You may want to run the binary directly to make lookup work properly.

For this to work, you need to have Swift 5+ installed.

Links

Who

Brought to you by ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.