forked from tools/josh
1
0
Fork 0

Properly escape symbols in useradd docs

This commit is contained in:
Florine W. Dekker 2020-12-07 15:04:54 +01:00
parent d6d893d414
commit 93eecc6985
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
3 changed files with 12 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "fwdekker.com",
"version": "0.39.4",
"version": "0.39.5",
"description": "The source code of [my personal website](https://fwdekker.com/).",
"author": "Felix W. Dekker",
"browser": "dist/bundle.js",

View File

@ -389,8 +389,8 @@ export enum ExitCode {
}
// An escaped newline escape symbol.
const n = "\\\\\\";
// An escaped newline escape symbol
const n = "".trimMultiLinesSep + "".trimMultiLinesSep;
/**
* Returns the script contents of the binaries in the `/bin` directory.
@ -1067,7 +1067,7 @@ return new Command(
\`Adds a user with the given data to the system.
The <u>name</u> must consist solely of alphanumerical characters.
The <u>home</u> directory and the <u>description</u> must not contain the pipe character (') or the newline ${n}
The <u>home</u> directory and the <u>description</u> must not contain the pipe character ('|') or the newline ${n}
character ('\\\\n').
If no <u>home</u> is given, it defaults to "/home/<u>name</u>".\`.trimMultiLines(),

View File

@ -4,6 +4,8 @@ interface String {
trimLines(): string;
trimMultiLines(): string;
trimMultiLinesSep: string;
}
/**
@ -37,9 +39,14 @@ String.prototype.trimLines = function(): string {
* split.
*/
String.prototype.trimMultiLines = function(): string {
return this.trimLines().split("\\").map(it => it.trimLeft()).join("");
return this.trimLines().split(this.trimMultiLinesSep).map(it => it.trimLeft()).join("");
};
/**
* The separator used in `#trimMultiLines`.
*/
String.prototype.trimMultiLinesSep = "\\\\\\";
interface Array<T> {
sortAlphabetically(transform: (element: T) => string, caseSensitive: boolean): T[];