Skip to content

Commit bf349b7

Browse files
committed
Handle CLI ouput of cds version
1 parent 1016878 commit bf349b7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/cli/grab-cli-texts.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ const toOutput = (str) => [
2020
`> ${cmd}`,
2121
'',
2222
str
23-
.replace(/\n.*home.*[|:].*/g, '') // remove absolute cds home path as it's system-specific
23+
.replace(/([\S]+)\/node_modules/g, '.../node_modules') // remove system-specific paths
24+
.replace(/([\S]+)\/bin\/node/g, '.../bin/node')
2425
.replace(/\<(.*?)\>/g, '&lt;$1&gt;') // <foo> -> &lt;foo&gt;
25-
.replace(/^\x1b\[1m(.*?)\x1b\[(:?0|39|49)m\n/gm, '<strong>$1</strong>') // bold at beginning of line -> strong
26-
.replace(/(\s*)\x1b\[4m(.*?)\x1b\[(:?0|39|49)m/g, '$1<i>$2</i>') // underline -> i
27-
.replace(/(\s*)\x1b\[\d+m(.*?)\x1b\[(:?0|39|49)m/g, '$1<em>$2</em>') // other colors -> em
26+
.replace(/^\x1b\[1m(.*?)\x1b\[(?:0|39|49)m\n/gm, '<strong>$1</strong>') // bold at beginning of line -> strong
27+
.replace(/(\s*)\x1b\[(?:2|4)m(.*?)\x1b\[(?:0|39|49)m/g, '$1<i>$2</i>') // underline or grey -> i
28+
.replace(/(\s*)\x1b\[[1-9]+m(.*?)\x1b\[(?:0|32|33|39|49)m/g, '$1<em>$2</em>') // other colors -> em
29+
.replace(/\x1b\[0m/g, '') // remove all remaining resets
2830
,
2931
`</pre>`
3032
].join('\n')

0 commit comments

Comments
 (0)