3d0c5470ae6b070518a3d06f6603436c021defd623be5179f0f69c2e766ef02bef6537ed92fc53fc58a15bf0f4e6c09af0b6af9d8108042342641875236bd9 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # cli-cursor [![Build Status](https://travis-ci.org/sindresorhus/cli-cursor.svg?branch=master)](https://travis-ci.org/sindresorhus/cli-cursor)
  2. > Toggle the CLI cursor
  3. The cursor is [gracefully restored](https://github.com/sindresorhus/restore-cursor) if the process exits.
  4. ## Install
  5. ```
  6. $ npm install cli-cursor
  7. ```
  8. ## Usage
  9. ```js
  10. const cliCursor = require('cli-cursor');
  11. cliCursor.hide();
  12. const unicornsAreAwesome = true;
  13. cliCursor.toggle(unicornsAreAwesome);
  14. ```
  15. ## API
  16. ### .show(stream?)
  17. ### .hide(stream?)
  18. ### .toggle(force?, stream?)
  19. #### force
  20. Useful for showing or hiding the cursor based on a boolean.
  21. #### stream
  22. Type: `stream.Writable`<br>
  23. Default: `process.stderr`
  24. ---
  25. <div align="center">
  26. <b>
  27. <a href="https://tidelift.com/subscription/pkg/npm-cli-cursor?utm_source=npm-cli-cursor&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
  28. </b>
  29. <br>
  30. <sub>
  31. Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
  32. </sub>
  33. </div>