项目原始demo,不改动
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
このリポジトリはアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュや、課題・プルリクエストのオープンはできません。

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. # ora [![Build Status](https://travis-ci.org/sindresorhus/ora.svg?branch=master)](https://travis-ci.org/sindresorhus/ora)
  2. > Elegant terminal spinner
  3. <p align="center">
  4. <img src="https://rawgit.com/sindresorhus/ora/master/screenshot.svg" width="500">
  5. </p>
  6. ## Install
  7. ```
  8. $ npm install --save ora
  9. ```
  10. *Show your support for Ora by buying this excellent [Node.js course](https://LearnNode.com/friend/AWESOME).*
  11. ## Usage
  12. ```js
  13. const ora = require('ora');
  14. const spinner = ora('Loading unicorns').start();
  15. setTimeout(() => {
  16. spinner.color = 'yellow';
  17. spinner.text = 'Loading rainbows';
  18. }, 1000);
  19. ```
  20. ## API
  21. It will gracefully not do anything when there's no TTY or when in a CI.
  22. ### ora([options|text])
  23. If a string is provided, it is treated as a shortcut for [`options.text`](#text).
  24. #### options
  25. Type: `Object`
  26. ##### text
  27. Type: `string`
  28. Text to display after the spinner.
  29. ##### spinner
  30. Type: `string` `Object`<br>
  31. Default: `dots` <img src="screenshot-spinner.gif" width="14">
  32. Name of one of the [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json). See `example.js` in this repo if you want to test out different spinners.
  33. Or an object like:
  34. ```js
  35. {
  36. interval: 80, // optional
  37. frames: ['-', '+', '-']
  38. }
  39. ```
  40. ##### color
  41. Type: `string`<br>
  42. Default: `cyan`<br>
  43. Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray`
  44. Color of the spinner.
  45. ##### interval
  46. Type: `number`<br>
  47. Default: Provided by the spinner or `100`
  48. Interval between each frame.
  49. Spinners provide their own recommended interval, so you don't really need to specify this.
  50. ##### stream
  51. Type: `WritableStream`<br>
  52. Default: `process.stderr`
  53. Stream to write the output.
  54. You could for example set this to `process.stdout` instead.
  55. ##### enabled
  56. Type: `boolean`
  57. Force enable/disable the spinner. If not specified, the spinner will be enabled if the `stream` is being run inside a TTY context (not spawned or piped) and/or not in a CI environment.
  58. ### Instance
  59. #### .start([text])
  60. Start the spinner. Returns the instance. Set the current text if `text` is provided.
  61. #### .stop()
  62. Stop and clear the spinner. Returns the instance.
  63. #### .succeed([text])
  64. Stop the spinner, change it to a green `✔` and persist the current text, or `text` if provided. Returns the instance. See the GIF below.
  65. #### .fail([text])
  66. Stop the spinner, change it to a red `✖` and persist the current text, or `text` if provided. Returns the instance. See the GIF below.
  67. #### .warn([text])
  68. Stop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided. Returns the instance.
  69. #### .info([text])
  70. Stop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided. Returns the instance.
  71. #### .stopAndPersist([options])
  72. Stop the spinner and change the symbol or text. Returns the instance. See the GIF below.
  73. ##### options
  74. Type: `Object`
  75. ###### symbol
  76. Type: `string`<br>
  77. Default: `' '`
  78. Symbol to replace the spinner with.
  79. ###### text
  80. Type: `string`<br>
  81. Default: Current text
  82. Text to be persisted.
  83. <img src="screenshot-2.gif" width="480">
  84. #### .clear()
  85. Clear the spinner. Returns the instance.
  86. #### .render()
  87. Manually render a new frame. Returns the instance.
  88. #### .frame()
  89. Get a new frame.
  90. #### .text
  91. Change the text.
  92. #### .color
  93. Change the spinner color.
  94. ### ora.promise(action, [options|text])
  95. Starts a spinner for a promise. The spinner is stopped with `.succeed()` if the promise fulfills or with `.fail()` if it rejects. Returns the spinner instance.
  96. #### action
  97. Type: `Promise`
  98. ## Related
  99. - [cli-spinners](https://github.com/sindresorhus/cli-spinners) - Spinners for use in the terminal
  100. - [listr](https://github.com/SamVerschueren/listr) - Terminal task list
  101. - [CLISpinner](https://github.com/kiliankoe/CLISpinner) - Terminal spinner library for Swift
  102. - [halo](https://github.com/ManrajGrover/halo) - Python port
  103. - [spinners](https://github.com/FGRibreau/spinners) - Terminal spinners for Rust
  104. ## License
  105. MIT © [Sindre Sorhus](https://sindresorhus.com)