-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·59 lines (50 loc) · 1.97 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#! /usr/bin/env node
const { program } = require('commander')
// commmands
const check = require('./commands/check')
const find = require('./commands/find')
const add = require('./commands/add')
const makeJson = require('./commands/make-json')
const rmDuplicates = require('./commands/rm-duplicates')
const rmKeywords = require('./commands/rm-keywords')
// isup check
program
.command('check')
.description('Checks website(s) status')
.option('-t, --timeout <timeout>', 'Timeout value in ms.', '5000')
.option('--filter <keywords>', 'Filter websites by keywords (e.g. "Dev, Client")')
.requiredOption('--file <filepath>', 'The JSON file containing the websites to check.')
.action(check)
// isup make-json
program
.command('make-json')
.description('Creates a "websites-sample.json" file with the correct layout that other commands can use')
.option('-o, --output <path>', 'Where to save the JSON file')
.action(makeJson)
// isup find
program
.command('find')
.description('Checks if a website is already inside the JSON file.')
.requiredOption('--file <filepath>', 'The JSON file to check.')
.requiredOption('--url <url>', 'The url of the website to search for.')
.action(find)
// isup add
program
.command('add')
.description('Add a new website inside the JSON file.')
.requiredOption('--file <filepath>', 'The JSON file to save the website.')
.action(add)
// isup rm-duplicates
program
.command('rm-duplicates')
.description('Removes duplicate entries from the JSON file.')
.requiredOption('--file <filepath>', 'The JSON file to search for duplicates.')
.action(rmDuplicates)
// isup rm-keywords
program
.command('rm-keywords')
.description('Removes all websites with specified keywords from the JSON file.')
.requiredOption('--file <filepath>', 'The JSON file containing the websites.')
.requiredOption('-k, --keywords <keywords>', 'The keywords to remove.')
.action(rmKeywords)
program.parse()