{"id":20544166,"url":"https://github.com/flintprocessor/motor","last_synced_at":"2025-04-14T09:52:22.390Z","repository":{"id":63910101,"uuid":"134294032","full_name":"flintprocessor/Motor","owner":"flintprocessor","description":"Swift cli spinner. Simple and fully customizable.","archived":false,"fork":false,"pushed_at":"2018-07-01T06:46:38.000Z","size":115,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-22T06:31:46.548Z","etag":null,"topics":["cli","spinner","swift","swift-package-manager"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flintprocessor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-21T16:16:00.000Z","updated_at":"2024-04-07T13:13:45.000Z","dependencies_parsed_at":"2022-11-29T07:10:26.509Z","dependency_job_id":null,"html_url":"https://github.com/flintprocessor/Motor","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flintprocessor%2FMotor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flintprocessor%2FMotor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flintprocessor%2FMotor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flintprocessor%2FMotor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flintprocessor","download_url":"https://codeload.github.com/flintprocessor/Motor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860007,"owners_count":21173339,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","spinner","swift","swift-package-manager"],"created_at":"2024-11-16T01:42:48.640Z","updated_at":"2025-04-14T09:52:22.359Z","avatar_url":"https://github.com/flintprocessor.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\u003cimg src=\"/Assets/logo.svg\" width=\"450\" /\u003e\u003c/div\u003e\n\u003ch1 align=\"center\"\u003e\n  \u003cb\u003eMotor\u003c/b\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://github.com/flintbox/Motor/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/release/flintbox/Motor.svg\" alt=\"GitHub release\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://swift.org/package-manager\"\u003e\u003cimg src=\"https://img.shields.io/badge/Swift%20PM-compatible-orange.svg\" alt=\"Swift Package Manager\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/flintbox/Motor/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/mashape/apistatus.svg\" alt=\"license\" /\u003e\u003c/a\u003e\n\u003c/h1\u003e\n\n*Swift cli spinner. **Simple** and **fully customizable**.*\n\n**Table of Contents**\n- [Demo](#demo)\n- [Installation](#installation)\n- [Customization](#customization)\n  - [Pattern](#pattern)\n  - [Delay](#delay)\n  - [Message](#message)\n- [Contribute](#contribute)\n\n## [Demo](https://github.com/flintbox/Motor/blob/master/Sources/motor-example/main.swift)\n\n```swift\nimport Foundation\nimport Motor\n\n/// Initialize spinner.\nlet spinner = Spinner(pattern: Patterns.dots)\n/// Start spinner.\nspinner.start(message: \"Motor initiated...\")\n/// Do your job.\nsleep(2)\n/// Print message.\nspinner.display(\"Do something...\")\n/// Do another job.\nsleep(3)\n/// Stop spinner with message.\nspinner.stop(message: \"✓\".color(.green) + \" Done!\")\n```\n\n### On terminal\n\n![Demo](Assets/demo.gif)\n\n## Installation\n\nAdd Motor to `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/flintbox/Motor\", from: \"0.1.1\")\n]\n```\n\n## Customization\n\n### [Pattern](https://github.com/flintbox/Motor/blob/master/Sources/Motor/Pattern.swift)\n\n```swift\npublic struct Pattern {\n\n    public let frames: [String]\n    public let fps: UInt32\n}\n```\n\nSpinner pattern. `frames` for frames of the animation. `fps`(frames per second) for frame rate.\n\n### [Delay](https://github.com/flintbox/Motor/blob/master/Sources/Motor/Animator.swift)\n\n```swift\nopen class Animator: Operation {\n\n    public init(pattern: Pattern, delay: UInt32) {\n        spinner = Animation(pattern: pattern)\n        self.delay = delay\n        super.init()\n    }\n}\n```\n\nDelay before starting animation. Useful when duration of the job could be short and don't want to flash spinner.\n\n### [Message](https://github.com/flintbox/Motor/blob/master/Sources/Motor/Spinner.swift)\n\n```swift\nopen class Spinner {\n\n    open func start(message: String = \"\") {\n    }\n\n    open func display(_ message: String) {\n    }\n\n    open func stop(message: String? = nil) {\n    }\n}\n```\n\nOn start, during or termination of the animation. Show message beside spinner. **Please, keep in mind that the spinner and message should be in one line to be correctly animated.**\n\n## Contribute\n\nIf you have good idea or suggestion? Please, don't hesitate to open a pull request or send me an [email](mailto:contact@jasonnam.com).\n\nHope you enjoy building command line tool with Motor!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflintprocessor%2Fmotor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflintprocessor%2Fmotor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflintprocessor%2Fmotor/lists"}