Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iyowei/cli-cancel-or-continue
拦停命令行会话,以选择中断或继续当前会话。
https://github.com/iyowei/cli-cancel-or-continue
cli iyowei nodejs prompt utilities
Last synced: about 7 hours ago
JSON representation
拦停命令行会话,以选择中断或继续当前会话。
- Host: GitHub
- URL: https://github.com/iyowei/cli-cancel-or-continue
- Owner: iyowei
- License: mit
- Created: 2021-12-14T15:36:32.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-18T07:36:41.000Z (almost 3 years ago)
- Last Synced: 2024-09-30T06:39:35.460Z (about 1 month ago)
- Topics: cli, iyowei, nodejs, prompt, utilities
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[Node Version Badge]: https://img.shields.io/badge/node.js-%3E%3D12.20.0-brightgreen?style=flat&logo=Node.js
[Download Node.js]: https://nodejs.org/en/download/
[PRs Welcome Badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat# cancelOrContinue()
> 拦停命令行会话,以选择中断或继续当前会话。
## 使用
- 返回 {Promise} 在命令行接收到输入信号时释放,或当用户输入的是 `ctrl + c` 快捷键时,终止命令行会话。
```js
import { log } from "console";
import cancelOrContinue from "@iyowei/cli-cancel-or-continue";(async () => {
log("按 [ctrl + c] 终止,或按其它 [任意] 键继续...");
await cancelOrPressAnyKeyToContinue();log("结束");
})();
```## 安装
[![Node Version Badge][Node Version Badge]][Download Node.js]
```shell
# Pnpm
pnpm add @iyowei/cli-cancel-or-continue# yarn
yarn add @iyowei/cli-cancel-or-continue# npm
npm add @iyowei/cli-cancel-or-continue
```## 参与贡献
![PRs Welcome][PRs Welcome Badge]