Console Dialog
Create a message dialog in node
Install
$ npm i console-dialog
Usage
const consoleDialog = ;console;/**┌────────┐│ Hello! │└────────┘*/ let dialog = width20;let msg = ;msg;msg;dialog;console;/**┌─────────────────────┐│ this is dialog with ││ multiple lines │└─────────────────────┘*/ let dialog = width20;dialog;dialog;console;/**┌─────────────────────┐│ this is dialog with ││ multiple lines │└─────────────────────┘*/ let dialog = width40;dialog;dialog;dialog;dialog;dialog;console;/*╒═════════════════════════════════════════╕│ how text can be align │╞═════════════════════════════════════════╡│ left ││ center ││ right │╞═════════════════════════════════════════╡│ using align option │╘═════════════════════════════════════════╛*/ let dialog = ;dialog;console;console;console;/*┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓┃ dialog with border weight with options ┃┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛╔════════════════════════════════════════╗║ dialog with border weight with options ║╚════════════════════════════════════════╝╭────────────────────────────────────────╮│ dialog with border weight with options │╰────────────────────────────────────────╯*/ dialog = ;dialog;dialog;console;/** ┌─────────────────────────┐ │ the length of this mess │ │ age is greater than the │ │ width of the dialog. │ │ so it's got wrapped dow │ │ n to a new line. │ └─────────────────────────┘ */ dialogconsole;/** ╒════════════════════════════════════════════════════════════════════════════════╕ │ but the dynamic-width option will make dialog more flexible up to the messages │ ╞════════════════════════════════════════════════════════════════════════════════╡ │ the length of this message is greater than the width of the dialog. │ │ so it's got wrapped down to a new line. │ └────────────────────────────────────────────────────────────────────────────────┘ */
Dialog Options
Border style
weight
- Changes Border line style.
- Default:
"single"
- Values:
"single"
,"double"
,"bold"
- Conditions:
"bold"
- Dialog must not have header or footer
corner
- Changes border corner style.
- Default:
- values:
"round"
- Conditions:
"round"
- Dialog must not have header or footer
Dialog width
width
- Enable flexible width based on maximum length of lines.
- Default:
dynamic
- Values:
dynamic
- Conditions:
dynamic
- The maximum length of lines must be greater than the declared dialog width.
Text alignment
align
- Align appended lines in the dialog.
- Default:
"left"
- Values:
"left"
,"center"
,"right"
- Conditions:
"center"
,"right"
- The length of lines must be less than the declared dialog width.