node 18 guard

This commit is contained in:
Niccolo Borgioli 2023-05-12 18:55:33 +02:00
parent bc156f504f
commit 63d72ca17e
No known key found for this signature in database
GPG Key ID: D93C615F75EE4F0B
1 changed files with 3 additions and 0 deletions

View File

@ -18,6 +18,9 @@ const url = new Argument('<url>', 'The url to open')
const views = new Option('-v --views <number>', 'Amount of views before getting destroyed').argParser(parseNumber)
const minutes = new Option('-m --minutes <number>', 'Minutes before the note expires').argParser(parseNumber)
// Node 18 guard
parseInt(process.version.slice(1).split(',')[0]) < 18 && exit('Node 18 or higher is required')
async function checkConstrains(constrains: { views?: number; minutes?: number }) {
const { views, minutes } = constrains
if (views && minutes) exit('cannot set view and minutes constrains simultaneously')