{"id":19904310,"url":"https://github.com/alloc/misty","last_synced_at":"2025-10-20T03:05:01.638Z","repository":{"id":57298386,"uuid":"353242593","full_name":"alloc/misty","owner":"alloc","description":"Logging utils for command line","archived":false,"fork":false,"pushed_at":"2022-06-24T17:26:50.000Z","size":1200,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T18:52:26.900Z","etag":null,"topics":["cli","command-line","logging"],"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/alloc.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":"2021-03-31T05:55:54.000Z","updated_at":"2022-01-20T22:27:00.000Z","dependencies_parsed_at":"2022-09-06T04:20:44.453Z","dependency_job_id":null,"html_url":"https://github.com/alloc/misty","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fmisty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fmisty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fmisty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fmisty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alloc","download_url":"https://codeload.github.com/alloc/misty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252126548,"owners_count":21698964,"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","command-line","logging"],"created_at":"2024-11-12T20:27:50.050Z","updated_at":"2025-10-20T03:05:01.581Z","avatar_url":"https://github.com/alloc.png","language":"TypeScript","funding_links":["https://paypal.me/alecdotbiz"],"categories":[],"sub_categories":[],"readme":"# misty \u003cimg src=\"https://raw.githubusercontent.com/alloc/misty/master/misty.png\" height=\"40\"/\u003e\n\n[![npm](https://img.shields.io/npm/v/misty.svg)](https://www.npmjs.com/package/misty)\n[![Code style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/alecdotbiz)\n\n\u003e Logging utils for command line\n\n\u0026nbsp;\n\n## Example\n\nClone `misty` and run the `test.js` script.\n\n```sh\ngit clone https://github.com/alloc/misty\nnode misty/test.js\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/alloc/misty/master/test.gif\" height=\"500\"/\u003e\n\n\u0026nbsp;\n\n## Usage\n\n```ts\nimport {\n  isInteractive,\n  warn,\n  warnOnce,\n  fatal,\n  success,\n  clear,\n  print,\n} from 'misty'\n\nif (isInteractive) {\n  // Prompt the user or something.\n}\n\n// Print a yellow message with [!] in front.\nwarn('Be careful')\n\n// Like `warn` but messages are deduplicated.\nwarnOnce('Deprecated: Use foo instead')\n\n// Print a message to stderr with red [!] in front. Then call process.exit(1)\nfatal('Bollocks')\n\n// Print a message with green checkmark in front.\nsuccess('We did it!')\n\n// Clear the screen and scrollback.\nclear()\n\n// Clear two lines above the cursor.\nclear(2)\n\n// Like console.log without a line break. Useful for control sequences.\nprint('...')\n```\n\n\u0026nbsp;\n\n### Tasks\n\nThe `misty/task` module provides the `startTask` function, which helps you communicate what your script is doing without spamming the final output. **Task logs are transient,** so it's best to avoid using tasks for information that could be useful for debugging.\n\nTasks are logs that:\n- have a spinner in front\n- stick to the end\n- can be updated\n- can be finished\n- print their elapsed time\n\n```ts\nimport { startTask } from 'misty/task'\n\nconst task = startTask('Building…')\ntask.update('Analyzing…')\ntask.finish('Build completed')\n```\n\n**What else should you know?**\n- Multiple tasks can be active at once.\n- Call `finish` with no message to hide the task.\n\n\u0026nbsp;\n\n### Spinner\n\nThe `misty/spin` module provides functions to customize the spinner\nand build your own task-like messages.\n\n```ts\nimport { setSpinner } from 'misty/spin'\n\n// Customize the spinner!\nsetSpinner({\n  interval: 50,\n  frames: ['◐', '◓', '◑', '◒'],\n  color: require('kleur').magenta,\n})\n\n// These are for advanced usage.\nimport { spin, spinListeners, getSpinner } from 'misty/spin'\n```\n\n**What else should you know?**\n- Animating multiple different spinners is not supported.\n- Tasks use the spinner passed to `setSpinner`.\n\n\u0026nbsp;\n\n### Prompts\n\nPrompts are not supported by `misty`, but I recommend these packages:\n- [`clikey`](https://github.com/zewish/clikey) for keypress events\n- [`prompts`](https://github.com/terkelg/prompts) for user input\n\n\u0026nbsp;\n\n### Colors\n\nColor support is provided by [`kleur`](https://github.com/lukeed/kleur), so you should use that too.\n\n\u0026nbsp;\n\n### Logging\n\nLogs are handled by [`shared-log`](https://github.com/alloc/shared-log).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Fmisty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falloc%2Fmisty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Fmisty/lists"}