♻️ Be more explicit in RegExp parsing

This commit is contained in:
C-3PO 2018-11-04 17:08:35 +01:00
parent 9208d5df45
commit a073033bfb
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
3 changed files with 6 additions and 6 deletions

View file

@ -5,8 +5,8 @@ import { getPatchZip, ISsnFileEntry, Product, verifyProductName } from 'ssn';
const { args, fail } = parseArguments({
product: { short: 'p', description: 'Name of the product you want to get the patch info on', verify: verifyProductName, message: (value) => `"${value}" is not a valid product name.` },
from: { short: 'f', description: 'Number of the from release, must be an integer in the range [-1, 999]', verify: (str) => (str.match(/^(-1|0|[1-9][0-9]{0,2})$/) !== null) },
to: { short: 't', description: 'Number of the to release, must be an integer in the range [0, 999]', verify: (str) => (str.match(/^(0|[1-9][0-9]{0,2})$/) !== null) },
from: { short: 'f', description: 'Number of the from release, must be an integer in the range [-1, 999]', verify: (str) => (str.match(/^(?:-1|0|[1-9][0-9]{0,2})$/) !== null) },
to: { short: 't', description: 'Number of the to release, must be an integer in the range [0, 999]', verify: (str) => (str.match(/^(?:0|[1-9][0-9]{0,2})$/) !== null) },
}, (origArgs) => ((origArgs.length === 3) ? ['--product', origArgs[0], '--from', origArgs[1], '--to', origArgs[2]] : undefined));
//Get the .zip file from this patch and write output to stdout

View file

@ -5,8 +5,8 @@ import { getSolidpkg, ISolidSimple, Product, verifyProductName } from 'ssn';
const { args, fail } = parseArguments({
product: { short: 'p', description: 'Name of the product you want to get the solidpkg on', verify: verifyProductName, message: (value) => `"${value}" is not a valid product name.` },
from: { short: 'f', description: 'Number of the from release, must be an integer in the range [-1, 999]', verify: (str) => (str.match(/^(-1|0|[1-9][0-9]{0,2})$/) !== null) },
to: { short: 't', description: 'Number of the to release, must be an integer in the range [0, 999]', verify: (str) => (str.match(/^(0|[1-9][0-9]{0,2})$/) !== null) },
from: { short: 'f', description: 'Number of the from release, must be an integer in the range [-1, 999]', verify: (str) => (str.match(/^(?:-1|0|[1-9][0-9]{0,2})$/) !== null) },
to: { short: 't', description: 'Number of the to release, must be an integer in the range [0, 999]', verify: (str) => (str.match(/^(?:0|[1-9][0-9]{0,2})$/) !== null) },
}, (origArgs) => ((origArgs.length === 3) ? ['--product', origArgs[0], '--from', origArgs[1], '--to', origArgs[2]] : undefined));
//Get solidpkg and write output to stdout

View file

@ -5,8 +5,8 @@ import { installPatch, Product, verifyProductName } from 'ssn';
const { args, fail } = parseArguments({
product: { short: 'p', description: 'Name of the product you want to install', verify: verifyProductName, message: (value) => `"${value}" is not a valid product name.` },
from: { short: 'f', description: 'Number of the from release, must be an integer in the range [-1, 999]', verify: (str) => (str.match(/^(-1|0|[1-9][0-9]{0,2})$/) !== null) },
to: { short: 't', description: 'Number of the to release, must be an integer in the range [0, 999]', verify: (str) => (str.match(/^(0|[1-9][0-9]{0,2})$/) !== null) },
from: { short: 'f', description: 'Number of the from release, must be an integer in the range [-1, 999]', verify: (str) => (str.match(/^(?:-1|0|[1-9][0-9]{0,2})$/) !== null) },
to: { short: 't', description: 'Number of the to release, must be an integer in the range [0, 999]', verify: (str) => (str.match(/^(?:0|[1-9][0-9]{0,2})$/) !== null) },
}, (origArgs) => ((origArgs.length === 3) ? ['--product', origArgs[0], '--from', origArgs[1], '--to', origArgs[2]] : undefined));
//TODO: set directory with existing patch data