{"id":21864339,"url":"https://github.com/harrypeach/kia","last_synced_at":"2025-04-14T20:53:20.309Z","repository":{"id":39909382,"uuid":"262075732","full_name":"HarryPeach/kia","owner":"HarryPeach","description":"🦕 Simple terminal spinners for Deno","archived":false,"fork":false,"pushed_at":"2023-01-15T01:39:07.000Z","size":78,"stargazers_count":53,"open_issues_count":3,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T20:43:22.802Z","etag":null,"topics":["cli-spinners","deno","hacktoberfest","terminal-spinners"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/HarryPeach.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":"2020-05-07T14:38:13.000Z","updated_at":"2025-04-01T23:46:59.000Z","dependencies_parsed_at":"2023-02-09T21:01:09.789Z","dependency_job_id":null,"html_url":"https://github.com/HarryPeach/kia","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryPeach%2Fkia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryPeach%2Fkia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryPeach%2Fkia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryPeach%2Fkia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarryPeach","download_url":"https://codeload.github.com/HarryPeach/kia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961048,"owners_count":21189990,"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-spinners","deno","hacktoberfest","terminal-spinners"],"created_at":"2024-11-28T04:08:53.415Z","updated_at":"2025-04-14T20:53:20.265Z","avatar_url":"https://github.com/HarryPeach.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kia\n\n\u003e Simple terminal spinners for Deno 🦕\n\n`Version 0.4.1`\n\n![](https://github.com/HarryPeach/kia/workflows/CI/badge.svg)\n\n![weather.ts example](https://user-images.githubusercontent.com/4750998/81313185-710ac900-907f-11ea-9735-d623559d08f6.gif)\n\n\u003e Kia is based on, and has much of the features of,\n\u003e [ora](https://www.npmjs.com/package/ora). The project was also influenced by\n\u003e the work of: [cli-spinners](https://www.npmjs.com/package/cli-spinners), and\n\u003e [CLI Spinners for Deno](https://deno.land/x/cli_spinners/)\n\n## Usage\n\n```typescript\nimport Kia from \"https://deno.land/x/kia@0.4.1/mod.ts\";\n\n// Just a function to async sleep\nfunction sleep(ms: number) {\n\treturn new Promise((resolve) =\u003e setTimeout(resolve, ms));\n}\n\nconst kia: any = new Kia(\"I will be back in about 3 seconds\");\nkia.start();\nawait sleep(3000); // or any other async action that'll take some time\nkia.succeed(\"Action completed\");\n```\n\nMore thorough examples are available in the\n[examples folder](https://github.com/HarryPeach/kia/tree/master/examples)\n\n## API\n\n### kia()\n\n### kia(text)\n\n### kia(options)\n\nKia can be created with a string or the Options interface. A string is simply\nmapped to `Options.text`\n\n```typescript\nconst kia = new Kia(\"Hello\");\n// or\nconst kia = new Kia({\n\ttext: \"Hello\",\n\tcolor: \"Red\",\n});\n```\n\n#### options\n\nYou can pass any of the following options to the kia context:\n\n##### text\n\nType: String\n\nDefault: \"\"\n\nThe text to display after the spinner\n\n##### color\n\nType:\n[Color](https://github.com/HarryPeach/kia/blob/8fb27cbd0bb4ef08ad26124d4a6e4f2ba2dc0c5c/util.ts#L6)\n\nDefault: \"white\"\n\nThe color for the spinner to be. Uses the color type in util.ts, which maps to\nthe Deno standard colors.\n\n##### spinner\n\nType:\n[Spinner](https://github.com/HarryPeach/kia/blob/8fb27cbd0bb4ef08ad26124d4a6e4f2ba2dc0c5c/spinners.ts#L1)\n\nDefault: Dependent on OS (See below)\n\nThe spinner that the Kia instance should use. There are spinners provided in\n`spinners.ts` or you can provide it with an object like so:\n\n```typescript\n{\n    interval: 80,\n    frames: [\"-\", \"|\"]\n}\n```\n\nOn windows the spinner defaults to `windows`, while on other OSes it defaults to\n`dots`.\n\nSpinners can also be imported from anywhere as long as they follow this format.\nSee the `examples/externalSpinners.ts` example for more info.\n\n##### indent\n\nType: number\n\nDefault: 0\n\nThe level of indentation of the spinner in spaces\n\n##### cursor\n\nType: boolean\n\nDefault: false\n\nWhether or not to display a cursor when the spinner is active\n\n##### writer\n\nType: Deno.Writer\n\nDefault: Deno.stdout\n\nThe resource to output to. This can be anything that uses the Writer interface\nincluding stdout, stderr, and files.\n\n### Instance\n\n#### .start(text?)\n\nStarts the spinner. Optionally sets the text at the same time. Returns Kia\ninstance.\n\n#### .stop()\n\nStops the spinner and clears the line. Returns Kia instance.\n\n#### .set(text)\n\n#### .set(options)\n\nAllows you to change the spinners options. Returns Kia instance.\n\n```typescript\nconst kia = new Kia(\"Hello\");\nkia.set({ text: \"Goodbye\", color: \"Red\" });\n```\n\n#### .succeed(text?)\n\n#### .fail(text?)\n\n#### .warn(text?)\n\n#### .info(text?)\n\nStops the spinner, and returns a message with the current text or the provided\n`text` as well as an icon indicating status. Wraps around `stopWithFlair()`.\nReturns Kia instance.\n\n#### .stopWithFlair(text, flair)\n\nStops the spinner, and returns a message with the current text or the provided\n`text` as well as the preceding flair/icon. Returns Kia instance.\n\n#### .stopAndPersist(options)\n\nStops the spinner and holds it in a static state. Returns the instance.\n\n#### .renderNextFrame()\n\nRenders the next frame of the spinner when it is stopped (i.e. can only be run\nafter .stopAndPersist()).\n\n#### .getText()\n\nReturns the current text of the spinner\n\n#### .getFrame()\n\nReturns the current spinner frame\n\n### forPromise(action, text)\n\n### forPromise(action, options)\n\n```typescript\nimport { forPromise } from \"https://deno.land/x/kia@0.4.1/mod.ts\";\n\nforPromise(\n\tasync () =\u003e {\n\t\tawait yourAsyncAction();\n\t},\n\t{ text: name },\n);\n```\n\nStarts a spinner for a promise. The spinner is stopped with `.succeed()` if the\npromise fulfills or with `.fail()` if it rejects. Returns the spinner instance.\n\n#### action\n\nType: Promise\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrypeach%2Fkia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharrypeach%2Fkia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrypeach%2Fkia/lists"}