Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/agens-no/swiff

Human readable time diffs on lines of output when running e.g. build commands like fastlane
https://github.com/agens-no/swiff

Last synced: 8 days ago
JSON representation

Human readable time diffs on lines of output when running e.g. build commands like fastlane

Awesome Lists containing this project

README

        

macOS only

# swiff

Why not let the computer do all that diffing of timestamps you tend to do manually?

## 👋 Usage

### Live with any command
```sh
command | swiff
```

Try it out
```sh
while true; do echo "Foo"; sleep $[ ($RANDOM % 3) + 1 ]s; done | swiff
```

### With [fastlane](https://github.com/fastlane/fastlane)
```sh
fastlane build | swiff --fastlane
```

Or even shorter
```sh
fastlane build | swiff -f
```

Or maybe you have an old build log from fastlane?
```sh
cat build.log | swiff -f
```
(Swiff parses the timestamps produced by fastlane)

### With xcodebuild

```swift
xcrun xcodebuild -project "MyApp.xcodeproj" -scheme "MyApp" | xcpretty | swiff
```

## 🤲 Example output

### Summary
Useful summary at the end with most important highlights

## ✌️ Install

### Globally by oneliner
```sh
git clone [email protected]:agens-no/swiff.git && cd swiff && make && cd .. && rm -rf swiff/
```

You may now type `swiff help` from any directory in terminal to verify that the install is complete

What is the oneliner doing?

1. Uses git to clone `swiff` to a directory `swiff` in your current directory
2. moves in to the created `swiff` folder
3. builds `swiff` using the Makefile (basically compiling `Sources/swiff/main.swift` and installing `swiff` at `/usr/local/bin/swiff`)
4. moves back out of the folder
5. deletes the `swiff` folder

### Globally by cloning
```sh
git clone [email protected]:agens-no/swiff.git
cd swiff
make
```

You may now type `swiff help` from any directory in terminal to verify that the install is complete

### Locally by oneliner

```sh
curl --fail https://raw.githubusercontent.com/agens-no/swiff/master/Sources/swiff/main.swift > swiff.swift && swiftc -o swiff swiff.swift && rm swiff.swift
```

You may now type `./swiff help` from your current directory and use it like `fastlane build | ./swiff -f`

What is the oneliner doing?

1. Uses curl to copy `Sources/swiff/main.swift` to a file called `swiff.swift` in your current directory
2. builds it using your current swift tooling
3. deletes swiff.swift

### Using [Mint](https://github.com/yonaskolb/mint)
```
$ mint install agens-no/swiff
```

### Installation issues?

Might be because of requirements: Swift 4, Xcode, macOS

[Create a new issue](https://github.com/agens-no/swiff/issues/new) and let me know!

## ✊ Advanced usage

```
Usage: swiff [-l low] [-m medium] [-h high] [-r reset-mark] [-d diff-mode] [-s summary-limit] [-f --fastlane]
-l, --low Threshold in seconds for low duration color formatting (default: 1)
-m, --medium Threshold in seconds for medium duration color formatting (default: 5)
-h, --high Threshold in seconds for high duration color formatting (default: 10)
-r, --reset-mark String match to reset total counter (default: none)
-d, --diff-mode Valid options is "live" or "fastlane" (default: live)
-s, --summary-limit Maximum number of lines in summary (default: 20)

-f, --fastlane Shortcut for --diff-mode fastlane --reset-mark "Step :"

Example: cat build.log | swiff --low 1 --medium 5 --high 10 --reset-mark "Step: " --diff-mode live --summary-limit 20

Example: fastlane build | swiff -f
```

## 🤙 License

MIT