Skip to content

Commit

Permalink
chore: update uuid generator
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Dec 30, 2024
1 parent b31a094 commit d2c50f5
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/commands/generate/uuid.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export default class extends Command {
static cli () {
return {
"options": {
"number": {
"description": `number of UUIDs to generate`,
"default": 1,
"schema": { "type": "integer", "minimum": 1 },
},
"copy": {
"description": `copy UUID to the clipboard`,
"default": false,
Expand All @@ -19,14 +24,20 @@ export default class extends Command {

// public
async run () {
const newUuid = uuid();
var uuids = [];

for ( let n = 0; n < process.cli.options.number; n++ ) {
uuids.push( uuid() );
}

uuids = uuids.join( "\n" );

console.log( newUuid );
console.log( uuids );

if ( process.cli.options.copy ) {
copyToClipboard( newUuid );
copyToClipboard( uuids );

console.log( "\nUUID copied to the clipboard" );
console.log( "\nUUIDs copied to the clipboard" );
}
}
}

0 comments on commit d2c50f5

Please sign in to comment.