-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b715485
Showing
14 changed files
with
863 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
/.build | ||
/Packages | ||
/*.xcodeproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Yutaro Muta | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
demo: | ||
swift run Demo | ||
|
||
test: | ||
swift test | ||
|
||
generate_xcodeproj: | ||
swift package generate-xcodeproj | ||
|
||
clean: | ||
swift package clean | ||
|
||
.PHONY: demo test generate_xcodeproj clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "SwiftPM", | ||
"repositoryURL": "https://github.com/apple/swift-package-manager.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "6983434787dec4e543e9d398a0a9acf63ccd4da1", | ||
"version": "0.2.1" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// swift-tools-version:4.0 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "ProgressSpinnerKit", | ||
products: [ | ||
.library(name: "ProgressSpinnerKit", targets: ["ProgressSpinnerKit"]), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/apple/swift-package-manager.git", from: "0.2.1"), | ||
], | ||
targets: [ | ||
.target(name: "ProgressSpinnerKit", dependencies: ["Utility"]), | ||
.testTarget(name: "ProgressSpinnerKitTests", dependencies: ["ProgressSpinnerKit"]), | ||
.target(name: "Demo", dependencies: ["ProgressSpinnerKit"]), | ||
] | ||
) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<p align="left"> | ||
<a href="https://developer.apple.com/swift"><img alt="Swift 4.1" src="https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat"/></a> | ||
<a href="https://swift.org/package-manager/"><img alt="Swift Package Manager" src="https://img.shields.io/badge/Swift_Package_Manager-compatible-green.svg?style=flat"/></a> | ||
<a href="https://github.com/yutailang0119/ProgressSpinnerKit/blob/master/LICENSE"><img alt="Lincense" src="https://img.shields.io/badge/license-MIT-black.svg?style=flat"/></a> | ||
</p> | ||
|
||
<p align="center"> | ||
<img src="./ProgressSpinnerKit.gif"> | ||
</p> | ||
|
||
A library to display an ActivityIndicator for CLI. | ||
Motivated by | ||
|
||
* [Swift Package Manager/Utility/ProgressBar](https://github.com/apple/swift-package-manager/blob/master/Sources/Utility/ProgressBar.swift) | ||
* [briandowns/spinner](https://github.com/briandowns/spinner) | ||
|
||
## A Work In Progress | ||
|
||
ProgressSpinnerKit is still in active development. | ||
|
||
## Dome | ||
|
||
![](./Sources/Demo/Demo.gif) | ||
|
||
## Installation | ||
|
||
### [Swift Package Manager](https://swift.org/package-manager/) | ||
|
||
```swift | ||
// swift-tools-version:4.0 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "test", | ||
dependencies: [ | ||
.package(url: "https://github.com/yutailang0119/ProgressSpinnerKit", from: "0.1.0"), | ||
], | ||
targets: [ | ||
.target(name: "targetName", dependencies: ["ProgressSpinnerKit"]), | ||
] | ||
) | ||
|
||
``` | ||
|
||
https://github.com/apple/swift-package-manager | ||
|
||
## Usege | ||
|
||
```swift | ||
import Basic | ||
import ProgressSpinnerKit | ||
|
||
let spinner = createProgressSpinner(forStream: Basic.stdoutStream, header: " Loading:") | ||
spinner.start() | ||
// Something on the main thread. | ||
spinner.stop() | ||
``` | ||
|
||
## Author | ||
|
||
[Yutaro Muta](https://github.com/yutailang0119) | ||
- muta.yutaro@gmail.com | ||
- [@yutailang0119](https://twitter.com/yutailang0119) | ||
|
||
## License | ||
|
||
ProgressSpinnerKit is available under the MIT license. See [the LICENSE file](./LICENSE) for more info. | ||
This software includes the work that is distributed in the Apache License 2.0. |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
// | ||
// main.swift | ||
// Demo | ||
// | ||
// Created by Yutaro Muta on 2018/08/25. | ||
// | ||
|
||
import Foundation | ||
import Basic | ||
import POSIX | ||
import ProgressSpinnerKit | ||
|
||
private let duration = useconds_t(Double(2.0) * pow(1000, 2)) | ||
|
||
do { | ||
let defaultSpinner = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " default:") | ||
defaultSpinner.start() | ||
usleep(duration) | ||
defaultSpinner.stop() | ||
} | ||
|
||
do { | ||
let box1 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " box1:", spinner: Spinner(kind: .box1)) | ||
box1.start() | ||
usleep(duration) | ||
box1.stop() | ||
} | ||
|
||
do { | ||
let box2 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " box2:", spinner: Spinner(kind: .box2)) | ||
box2.start() | ||
usleep(duration) | ||
box2.stop() | ||
} | ||
|
||
do { | ||
let box3 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " box3:", spinner: Spinner(kind: .box3)) | ||
box3.start() | ||
usleep(duration) | ||
box3.stop() | ||
} | ||
|
||
do { | ||
let box4 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " box4:", spinner: Spinner(kind: .box4)) | ||
box4.start() | ||
usleep(duration) | ||
box4.stop() | ||
} | ||
|
||
do { | ||
let box5 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " box5:", spinner: Spinner(kind: .box5)) | ||
box5.start() | ||
usleep(duration) | ||
box5.stop() | ||
} | ||
|
||
do { | ||
let box6 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " box6:", spinner: Spinner(kind: .box6)) | ||
box6.start() | ||
usleep(duration) | ||
box6.stop() | ||
} | ||
|
||
do { | ||
let box7 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " box7:", spinner: Spinner(kind: .box7)) | ||
box7.start() | ||
usleep(duration) | ||
box7.stop() | ||
} | ||
|
||
do { | ||
let bar1 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " bar1:", spinner: Spinner(kind: .bar1)) | ||
bar1.start() | ||
usleep(duration) | ||
bar1.stop() | ||
} | ||
|
||
do { | ||
let bar2 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " bar2:", spinner: Spinner(kind: .bar2)) | ||
bar2.start() | ||
usleep(duration) | ||
bar2.stop() | ||
} | ||
|
||
do { | ||
let bar3 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " bar3:", spinner: Spinner(kind: .bar3)) | ||
bar3.start() | ||
usleep(duration) | ||
bar3.stop() | ||
} | ||
|
||
do { | ||
let bar4 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " bar4:", spinner: Spinner(kind: .bar4)) | ||
bar4.start() | ||
usleep(duration) | ||
bar4.stop() | ||
} | ||
|
||
do { | ||
let bar5 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " bar5:", spinner: Spinner(kind: .bar5)) | ||
bar5.start() | ||
usleep(duration) | ||
bar5.stop() | ||
} | ||
|
||
do { | ||
let bar6 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " bar6:", spinner: Spinner(kind: .bar6)) | ||
bar6.start() | ||
usleep(duration) | ||
bar6.stop() | ||
} | ||
|
||
do { | ||
let spin1 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin1:", spinner: Spinner(kind: .spin1)) | ||
spin1.start() | ||
usleep(duration) | ||
spin1.stop() | ||
} | ||
|
||
do { | ||
let spin2 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin2:", spinner: Spinner(kind: .spin2)) | ||
spin2.start() | ||
usleep(duration) | ||
spin2.stop() | ||
} | ||
|
||
do { | ||
let spin3 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin3:", spinner: Spinner(kind: .spin3)) | ||
spin3.start() | ||
usleep(duration) | ||
spin3.stop() | ||
} | ||
|
||
do { | ||
let spin4 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin4:", spinner: Spinner(kind: .spin4)) | ||
spin4.start() | ||
usleep(duration) | ||
spin4.stop() | ||
} | ||
|
||
do { | ||
let spin5 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin5:", spinner: Spinner(kind: .spin5)) | ||
spin5.start() | ||
usleep(duration) | ||
spin5.stop() | ||
} | ||
|
||
do { | ||
let spin6 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin6:", spinner: Spinner(kind: .spin6)) | ||
spin6.start() | ||
usleep(duration) | ||
spin6.stop() | ||
} | ||
|
||
do { | ||
let spin7 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin7:", spinner: Spinner(kind: .spin7)) | ||
spin7.start() | ||
usleep(duration) | ||
spin7.stop() | ||
} | ||
|
||
do { | ||
let spin8 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin8:", spinner: Spinner(kind: .spin8)) | ||
spin8.start() | ||
usleep(duration) | ||
spin8.stop() | ||
} | ||
|
||
do { | ||
let spin9 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin9:", spinner: Spinner(kind: .spin9)) | ||
spin9.start() | ||
usleep(duration) | ||
spin9.stop() | ||
} | ||
|
||
do { | ||
let spin10 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin10:", spinner: Spinner(kind: .spin10)) | ||
spin10.start() | ||
usleep(duration) | ||
spin10.stop() | ||
} | ||
|
||
do { | ||
let spin11 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin11:", spinner: Spinner(kind: .spin11)) | ||
spin11.start() | ||
usleep(duration) | ||
spin11.stop() | ||
} | ||
|
||
do { | ||
let spin12 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin12:", spinner: Spinner(kind: .spin12)) | ||
spin12.start() | ||
usleep(duration) | ||
spin12.stop() | ||
} | ||
|
||
do { | ||
let spin13 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin13:", spinner: Spinner(kind: .spin13)) | ||
spin13.start() | ||
usleep(duration) | ||
spin13.stop() | ||
} | ||
|
||
do { | ||
let spin14 = ProgressSpinnerKit.createProgressSpinner(forStream: Basic.stderrStream, header: " spin14:", spinner: Spinner(kind: .spin14)) | ||
spin14.start() | ||
usleep(duration) | ||
spin14.stop() | ||
} |
Oops, something went wrong.