You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.1 KiB

1 month ago
  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>