summaryrefslogtreecommitdiff
path: root/node_modules/command-line-usage/lib/section.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/command-line-usage/lib/section.js')
-rw-r--r--node_modules/command-line-usage/lib/section.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/node_modules/command-line-usage/lib/section.js b/node_modules/command-line-usage/lib/section.js
new file mode 100644
index 0000000..821a366
--- /dev/null
+++ b/node_modules/command-line-usage/lib/section.js
@@ -0,0 +1,29 @@
+class Section {
+ constructor () {
+ this.lines = []
+ }
+
+ add (lines) {
+ if (lines) {
+ const arrayify = require('array-back')
+ arrayify(lines).forEach(line => this.lines.push(line))
+ } else {
+ this.lines.push('')
+ }
+ }
+
+ toString () {
+ const os = require('os')
+ return this.lines.join(os.EOL)
+ }
+
+ header (text) {
+ const chalk = require('chalk')
+ if (text) {
+ this.add(chalk.underline.bold(text))
+ this.add()
+ }
+ }
+}
+
+module.exports = Section