Constructor
new Print(plugin, optsopt)
Class constructor
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
plugin | Object | Plugin instance | ||
opts | Object | <optional> | {} | Options to pass to ora |
- Source
Methods
clear() → {Object}
Clear spinner text
- Source
Return itself, usefull to chain methods
- Type:
- Object
fail(text, …argsopt) → {Object}
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 itself, usefull to chain methods
- Type:
- Object
fatal(text, …argsopt)
Print failed message, prefixed with a cross icon and terminate the app process
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
getElapsed(unitopt) → {string}
Get elapsed time since print 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) → {Object}
Print failed 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 itself, usefull to chain methods
- Type:
- Object
init()
Initialize print engine and read plugin's translation files
- Source
render() → {Object}
Force render spinner
- Source
Return itself, usefull to chain methods
- Type:
- Object
setOpts(argsopt)
Set spinner options
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
args | Array.<any> | <optional> | [] | Array of options. If the last argument is an object, it will be used to override ora options |
- Source
setText(text, …argsopt) → {Object}
Set spinner 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 options |
- Source
Return itself, usefull to chain methods
- Type:
- Object
spinner() → {Object}
Create a new spinner
- Source
Return new instance
- Type:
- Object
start(text, …argsopt) → {Object}
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 options |
- Source
Return itself, usefull to chain methods
- Type:
- Object
stop() → {Object}
Stop the spinner
- Source
Return itself, usefull to chain methods
- Type:
- Object
succeed(text, …argsopt) → {Object}
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 itself, usefull to chain methods
- Type:
- Object
warn(text, …argsopt) → {Object}
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 itself, usefull to chain methods
- Type:
- Object
write(text, …argsopt) → {string}
Interpolate and translate text according to the chosen language
Name | Type | Attributes | Description |
---|---|---|---|
text | string | Text pattern to translate. See sprintf for all supported token & format | |
args | any | <optional> <repeatable> | Variables to interpolate with text pattern above. If the last argument is an object, it will be use to override default translation option. Example: to force language to 'id', pass the last argument as "{ lang: 'id' }" |
- Source
Interpolated & translated text
- Type:
- string