mirror of
https://github.com/sern-handler/cli
synced 2026-06-06 01:16:53 +00:00
refactor: Simplifying logic, cleaning up code
This commit is contained in:
@@ -12,6 +12,5 @@ export async function editMain(name) {
|
||||
|
||||
output.main = name;
|
||||
|
||||
const result = () => writeFile(pjLocation, JSON.stringify(output, null, 2));
|
||||
return result();
|
||||
return writeFile(pjLocation, JSON.stringify(output, null, 2));
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
import { init } from './commands/init.js';
|
||||
const regex = /(?<=--|-)\w+/gm;
|
||||
const flags = process.argv.slice(2).join(' ').match(regex);
|
||||
|
||||
const rawArgs = process.argv.slice(2);
|
||||
const flags = rawArgs.join(' ').match(regex);
|
||||
|
||||
const args = rawArgs
|
||||
.join(' ')
|
||||
.trim()
|
||||
|
||||
@@ -61,9 +61,7 @@ export const token = {
|
||||
type: 'password',
|
||||
|
||||
validate: (/** @type {string} */ token) =>
|
||||
token.match(
|
||||
/(?<mfaToken>mfa\.[a-z0-9_-]{20,})|(?<basicToken>[a-z0-9_-]{23,28}\.[a-z0-9_-]{6,7}\.[a-z0-9_-]{27})/i
|
||||
)?.length
|
||||
(/(?<mfaToken>mfa\.[a-z0-9_-]{20,})|(?<basicToken>[a-z0-9_-]{23,28}\.[a-z0-9_-]{6,7}\.[a-z0-9_-]{27})/i).test(token)
|
||||
? true
|
||||
: 'Invalid token',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user