Constructor
new Print(plugin, optionsopt)
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
plugin | Plugin | Plugin instance. | ||
options | Print. | <optional> | {} | Options object. |
- Source
Members
buildText
Translate text, prefixed with counter and/or datetime etc.
- Source
options :Print.TOptions
Options object.
- Source
ora
ora instance
- Source
- See
startTime :Object
Start time of the instance, used to calculate elapsed time.
- Object
- Source
- See
Methods
clear() → {Print}
Clear spinner text.
- Source
Return the instance itself, usefull for method chaining
- Type:
fail(text, …argsopt) → {Print}
Print failed message, prefixed with a cross icon.
| Name | Type | Attributes | Description |
|---|---|---|---|
text | string | Text to use | |
args | any | <optional> <repeatable> | Any variable to interpolate text. If the last argument is an object, it will be used to override ora options |
- Source
Return the instance itself, usefull for method chaining
- Type:
fatal(text, …argsopt) → {void}
Print failed message, prefixed with a cross icon and exit application abruptly.
| Name | Type | Attributes | Description |
|---|---|---|---|
text | string | Text to use | |
args | any | <optional> <repeatable> | Any variable to interpolate text. If the last argument is an object, it will be used to override ora options |
- Source
- Type:
- void
getElapsed(unitopt) → {string}
Get elapsed time since instance is created.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
unit | string | <optional> | 'hms' | Unit's time. Put 'hms' (default) to get hour, minute, second format or of any format supported by dayjs |
- Source
Elapsed time since start
- Type:
- string
info(text, …argsopt) → {Print}
Print information message, prefixed with an info icon.
| Name | Type | Attributes | Description |
|---|---|---|---|
text | string | Text to use | |
args | any | <optional> <repeatable> | Any variable to interpolate text. If the last argument is an object, it will be used to override ora options |
- Source
Return the instance itself, usefull for method chaining
- Type:
render() → {Print}
Force render spinner.
- Source
Return the instance itself, usefull for method chaining
- Type:
setOpts() → {void}
Setting spinner options; override the one passed at constructor.
| Type | Description |
|---|---|
| Array.<any> | [args=[]] Array of options. If the last argument is an object, it will be used to override ora options |
- Source
- Type:
- void
setText(text, …argsopt) → {Print}
Set spinner's text,
| Name | Type | Attributes | Description |
|---|---|---|---|
text | string | Text to use | |
args | any | <optional> <repeatable> | Any variable to interpolate text. If the last argument is an object, it will be used to override ora's options |
- Source
Return the instance itself, usefull for method chaining
- Type:
spinner(optionsopt) → {Print}
Create a new print instance.
| Name | Type | Attributes | Description |
|---|---|---|---|
options | App. | <optional> | Options object. If not provided, defaults to the current options. |
- Source
Return new print instance.
- Type:
start(text, …argsopt) → {Print}
Start the spinner.
| Name | Type | Attributes | Description |
|---|---|---|---|
text | string | Text to use | |
args | any | <optional> <repeatable> | Any variable to interpolate text. If the last argument is an object, it will be used to override ora's options |
- Source
Return the instance itself, usefull for method chaining
- Type:
stop() → {Print}
Stop the spinner.
- Source
Return the instance itself, usefull for method chaining
- Type:
succeed(text, …argsopt) → {Print}
Print success message, prefixed with a check icon
| Name | Type | Attributes | Description |
|---|---|---|---|
text | string | Text to use | |
args | any | <optional> <repeatable> | Any variable to interpolate text. If the last argument is an object, it will be used to override ora options. |
- Source
Return the instance itself, usefull for method chaining
- Type:
warn(text, …argsopt) → {Print}
Print warning message, prefixed with a warn icon.
| Name | Type | Attributes | Description |
|---|---|---|---|
text | string | Text to use | |
args | any | <optional> <repeatable> | Any variable to interpolate text. If the last argument is an object, it will be used to override ora options |
- Source
Return the instance itself, usefull for method chaining
- Type:
Type Definitions
TOptions
- Object
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
showDatetime | boolean | <optional> | false | Show actual date & time |
showCounter | boolean | <optional> | false | Show as counter |
silent | boolean | <optional> | Suppress any messages. Defaults to the one set in config | |
ora | Object | <optional> | Ora's options object |
- Source
- See