From 72cdee2d62229446fe16421f111bce50d71b81ce Mon Sep 17 00:00:00 2001 From: Chester Wood Date: Sat, 26 Jan 2019 13:30:20 -0700 Subject: [PATCH 1/3] pass debug and stripAnsiSequences booleans to internal config --- index.js | 2 ++ 1 file changed, 2 insertions(+) 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 => { From d39f535a336b2c37fb5033670a0a28924b29ffae Mon Sep 17 00:00:00 2001 From: Chester Wood Date: Sat, 26 Jan 2019 14:08:56 -0700 Subject: [PATCH 2/3] Fix incorrect spelling of stripAnsiSequences in README Add a couple of hopefully helpful hints to the README. --- README.md | 15 +++++++++++++-- config.example | 3 ++- package.json | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) 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/package.json b/package.json index 1dda8e3..47a49d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hyper-autoprofile", - "version": "1.0.2", + "version": "1.0.3", "description": "Extension for Hyper.app to profile term according to shell prompt", "main": "index.js", "scripts": { From f4409a9e1910e972dcc3ece97e0cf3874570d6a9 Mon Sep 17 00:00:00 2001 From: CHaBou Date: Sat, 26 Jan 2019 18:14:39 -0700 Subject: [PATCH 3/3] Update package.json Co-Authored-By: chetstone --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 47a49d9..1dda8e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hyper-autoprofile", - "version": "1.0.3", + "version": "1.0.2", "description": "Extension for Hyper.app to profile term according to shell prompt", "main": "index.js", "scripts": {