Constructor
new ViewCLI(setupopt, cliopt)
Creates an instance of ViewCLI.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
setup |
Object |
<optional> |
The configuration for the view instance. Properties
|
||||||||||||||||||||
cli |
CLI |
<optional> |
The command-line interface instance. |
- Source:
Throws:
-
When essential parameters are missing.
- Type
- Error.Log
Extends
Members
StringBuilder :StringTemplateBuilder
The StringTemplateBuilder instance used for constructing string templates.
Type:
- Overrides:
- Source:
Template :Component
The template component for rendering the view content.
Type:
- Source:
name :string
The name of the view.
Type:
- string
- Source:
navigator :ViewNavigator
The view navigator for navigating between views.
Type:
- Source:
poolForm :PoolForm
The pool form associated with the view.
Type:
- Source:
Methods
boolAnswer(a, strictopt) → {boolean}
Converts a user input to a boolean value, considering 'y' or 'n' as affirmative and negative answers, respectively.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
a |
string | The user input to be converted to a boolean value ('y' or 'n'). |
||
strict |
boolean |
<optional> |
false | If set to true, strict mode requires 'y' or 'n' input only. |
- Overrides:
- Source:
Throws:
-
When strict mode is enabled and the input is not 'y' or 'n'.
- Type
- Error.Log
Returns:
The boolean value based on the user input.
- Type
- boolean
cli()
The command-line interface instance.
- Source:
getString() → {string}
Gets the rendered string content of the view.
- Source:
Returns:
The rendered string content of the view.
- Type
- string
goToView(viewPath, paramsopt)
Navigates to a specific view path with optional parameters.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
viewPath |
string | The path of the view to navigate to. |
|
params |
Object |
<optional> |
Additional parameters to be passed to the view. |
- Source:
Throws:
-
When an error occurs during view navigation.
- Type
- Error.Log
print(txt, addHeaderopt)
Prints a message to the console with optional header and project name.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
txt |
string | The text to be printed. |
|
addHeader |
string |
<optional> |
The optional header to be added to the message. |
- Overrides:
- Source:
printError(err)
Prints an error message to the console, including error name, message, and stack trace.
Parameters:
| Name | Type | Description |
|---|---|---|
err |
Error | The error object to be printed. |
- Overrides:
- Source:
printTable(data, optionsopt)
Prints tabular data to the console as a table.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
data |
Object | The data to be displayed in the table. |
|
options |
Object |
<optional> |
Additional options for printing the table, including headers. |
- Overrides:
- Source:
printTemplate(stringContent)
Prints a string template content to the console.
Parameters:
| Name | Type | Description |
|---|---|---|
stringContent |
string | The string template content to be printed. |
- Overrides:
- Source:
render(tableHeadersopt)
Renders the view, including its content, pool form, and navigator.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tableHeaders |
Object |
<optional> |
Additional headers for rendering tabular data. |
- Source:
Throws:
-
When an error occurs during view rendering.
- Type
- Error.Log