Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ Options:
will be inserted before each line Default: " "
--indentEmpty if the input string is empty, should we still
indent? Default: false
--isNewline <regex> a regular expression to replace newlines in the
input. Empty to leave newlines in place.
Default: "[^\\S\\r\\n\\v\\f\\x85\\u2028\
\u2029]*[\\r\\n\\v\\f\\x85\\u2028\\u2029]+\\s*"
-l,--locale <iso location> locale for grapheme segmentation. Has very
little effect at the moment
--newline <string> how to separate the lines of output Default:
Expand Down
12 changes: 1 addition & 11 deletions bin/linewrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ const config = {
default: LineWrap.DEFAULT_OPTIONS.indentEmpty,
description: 'if the input string is empty, should we still indent?',
},
isNewline: {
type: 'string',
default: LineWrap.DEFAULT_OPTIONS.isNewline.source,
argumentName: 'regex',
description: 'a regular expression to replace newlines in the input. Empty to leave newlines in place.',
},
locale: {
short: 'l',
type: 'string',
Expand Down Expand Up @@ -219,11 +213,7 @@ export async function main(
verbose: values.verbose,
width: parseInt(values.width, 10),
};
if (typeof values.isNewline === 'string') {
opts.isNewline = (values.isNewline.length === 0) ?
null :
new RegExp(values.isNewline, 'gu');
}

if (values.verbose) {
process.stdout.write(inspect(opts));
}
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
"license": "MIT",
"repository": "cto-af/linewrap-cli",
"dependencies": {
"@cto.af/linewrap": "3.0.0",
"@cto.af/linewrap": "3.2.0",
"minus-h": "3.0.0"
},
"devDependencies": {
"@cto.af/eslint-config": "6.0.4",
"@types/node": "22.15.29",
"@cto.af/eslint-config": "6.0.5",
"@types/node": "22.15.30",
"c8": "10.1.3",
"eslint": "9.28.0",
"eslint-plugin-mocha": "11.1.0"
},
"packageManager": "pnpm@10.11.0",
"packageManager": "pnpm@10.12.1",
"engines": {
"node": ">=20"
}
Expand Down
127 changes: 69 additions & 58 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions test/bin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ const HELP = [
' will be inserted before each line Default: " "',
' --indentEmpty if the input string is empty, should we still',
' indent? Default: false',
' --isNewline <regex> a regular expression to replace newlines in the',
' input. Empty to leave newlines in place.',
' Default: "[^\\\\S\\\\r\\\\n\\\\v\\\\f\\\\x85\\\\u2028\\',
' \\u2029]*[\\\\r\\\\n\\\\v\\\\f\\\\x85\\\\u2028\\\\u2029]+\\\\s*"',
' -l,--locale <iso location> locale for grapheme segmentation. Has very',
' little effect at the moment',
' --newline <string> how to separate the lines of output Default:',
Expand Down Expand Up @@ -192,18 +188,6 @@ test('cli', async t => {
);
assert.equal(res.stdout, ' \n');

// --isNewline
// --newlineReplacement
res = await exec(
{main, stdin: 'foobar'}, '--isNewline', 'o+', '--newlineReplacement', ' 99 ', '-w', '1'
);
assert.equal(res.stdout, 'f\n99\nbar\n');

res = await exec(
{main, stdin: 'foo\nbar'}, '--isNewline', ''
);
assert.equal(res.stdout, 'foo\nbar\n');

// --locale
// After reading UAX #29 again, I still don't think this changes
// anything visible.
Expand Down