diff --git a/README.md b/README.md index b565bf5..96cad01 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ module.exports = { backgroundColor: "#004" } ], - stripAnsiColors: true, //default + stripAnsiSequences: true, //default debug: false //default } } @@ -97,6 +97,17 @@ module.exports = { This section defines different patterns for parsing prompt components: username, host, path. +Note that `pattern` is a string literal passed to the `RegExp()` +constructor, so remember to escape backslashes in your regexp. For +example, if you used a site like [regex101.com](https://regex101.com) +to verify that your regexp `/\[(\w+):\s*(\w+)\](\s*\$)/` is correct, +you would double each backslash and write the pattern as: + +``` +pattern: '\\[(\\w+):\\s*(\\w+)\\](\\s*\\$)', +``` +The values for `hostname`, `username`, and `pattern` are indexes into the match array returned by `RegExp#exec`. + For example, define a pattern for MacOS bash default prompt: ``` @@ -133,7 +144,7 @@ See [here](http://ascii-table.com/ansi-escape-sequences-vt-100.php) for more det ### autoProfile.debug (Default: false) -If enabled, debug informations are written to console +If enabled, debug information is written to the DevTools console ## Caveat diff --git a/config.example b/config.example index 98c3469..aed392b 100644 --- a/config.example +++ b/config.example @@ -48,7 +48,8 @@ backgroundColor: '#004' } ], - stripAnsiSequences: true //default + stripAnsiSequences: true, //default + debug: false, //default } } } diff --git a/index.js b/index.js index b431c31..98901de 100644 --- a/index.js +++ b/index.js @@ -146,6 +146,8 @@ function formatConfiguration(autoProfileConfig) { if (!autoProfileConfig || !autoProfileConfig.prompts || !autoProfileConfig.profiles) { return formattedConfig; } + formattedConfig.debug = autoProfileConfig.debug; + formattedConfig.stripAnsiSequences = autoProfileConfig.stripAnsiSequences; formattedConfig.prompts = autoProfileConfig.prompts; const profiles = []; autoProfileConfig.profiles.forEach(profile => {