2020-03-07 11:45:40 +08:00
# cli-cursor [![Build Status](https://travis-ci.org/sindresorhus/cli-cursor.svg?branch=master)](https://travis-ci.org/sindresorhus/cli-cursor)
> Toggle the CLI cursor
The cursor is [gracefully restored ](https://github.com/sindresorhus/restore-cursor ) if the process exits.
## Install
```
2020-03-31 20:40:00 +08:00
$ npm install cli-cursor
2020-03-07 11:45:40 +08:00
```
## Usage
```js
const cliCursor = require('cli-cursor');
cliCursor.hide();
const unicornsAreAwesome = true;
cliCursor.toggle(unicornsAreAwesome);
```
## API
2020-03-31 20:40:00 +08:00
### .show(stream?)
2020-03-07 11:45:40 +08:00
2020-03-31 20:40:00 +08:00
### .hide(stream?)
2020-03-07 11:45:40 +08:00
2020-03-31 20:40:00 +08:00
### .toggle(force?, stream?)
2020-03-07 11:45:40 +08:00
2020-03-31 20:40:00 +08:00
#### force
Useful for showing or hiding the cursor based on a boolean.
2020-03-07 11:45:40 +08:00
#### stream
2020-03-31 20:40:00 +08:00
Type: `stream.Writable` < br >
2020-03-07 11:45:40 +08:00
Default: `process.stderr`
2020-03-31 20:40:00 +08:00
---
2020-03-07 11:45:40 +08:00
2020-03-31 20:40:00 +08:00
< div align = "center" >
< b >
< 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 >
< / b >
< br >
< sub >
Tidelift helps make open source sustainable for maintainers while giving companies< br > assurances about security, maintenance, and licensing for their dependencies.
< / sub >
< / div >