-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·206 lines (172 loc) · 5.12 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#! /usr/bin/env node
import { program, Argument } from 'commander'
import chalk from 'chalk'
import data from './utils/data.js'
import Colors from './utils/colors.js'
import init from './commands/init.js'
import stats from './commands/stats.js'
import open from './commands/open.js'
import openDash from './commands/dash.js'
import statusList from './commands/status/list.js'
import statusNew from './commands/status/new.js'
import statusDelete from './commands/status/delete.js'
import purlList from './commands/purl/list.js'
import purlNew from './commands/purl/new.js'
import purlDelete from './commands/purl/delete.js'
import pasteList from './commands/paste/list.js'
import pasteNew from './commands/paste/new.js'
import pasteDelete from './commands/paste/delete.js'
import pasteCopy from './commands/paste/copy.js'
import dnsList from './commands/dns/list.js'
import addressDirectory from './commands/addresses/directory.js'
import addressLookup from './commands/addresses/lookup.js'
if (process.argv.slice(2).length === 0)
{
console.log(chalk.hex(Colors.pramiPink).bold(`
♥ Welcome to the omg.lol cli
____ ____
,-"" "-.-" ""-,
/ __ , , , , __ \\
| ( ) '--' '--' ( ) |
\\ "" , , "" /
", "---" ,"
", ,"
"-, ,-"
sjw "-,_,-"
`))
}
/**
* Meta
*/
program
.command('init <address> <apikey>')
.description(chalk.hex(Colors.omgYellow).bold('Set your address and api key'))
.action(init)
program
.command('whoami')
.description('Check your settings for the CLI')
.action(() => {
console.log(chalk.magenta.bold(`👀 You are ${data.address()} and you have a valid API key`))
})
program
.command('stats')
.description('Get count of members and addresses')
.action(stats)
program
.command('open <address>')
.description('Open a page for an address (default: omg.lol)')
.option('-s, --statuslog', 'Open status.lol page')
.option('-w, --weblog', 'Open weblog.lol page')
.option('-p, --paste', 'Open paste.lol page')
.option('-m, --mastodon', 'Open profile on social.lol')
.option('-u, --url', 'Open url.lol page')
.option('-n, --now', 'Open the /now page')
.action(open)
program
.command('dash')
.description('Open the dashboard page for a specific service')
.option('-s, --statuslog', 'Open status.lol page')
.option('-w, --weblog', 'Open weblog.lol page')
.option('-p, --paste', 'Open paste.lol page')
.option('-u, --url', 'Open PURLs page')
.option('-n, --now', 'Open the /now page')
.option('-e, --email', 'Open the email page')
.option('-d, --dns', 'Open the DNS page')
.option('-sw, --switchboard', 'Open the switchboard page')
.action(openDash)
/**
* Statuses
*/
const status = program
.command('status')
.description('Interact with the statuslog')
status.command('list')
.option('-a, --address [address]', 'Show statuses for an address')
.option('-g, --global', 'List the global statuslog')
.option('-l, --limit [limit]', 'How many statuses to show')
.description('List statuses from the status log')
.action(statusList)
status
.command('new')
.argument('emoji')
.argument('<status...>')
.description('Post a new status')
.action(statusNew)
status
.command('delete <statusid>')
.description('Delete a status')
.action(statusDelete)
/**
* Addresses
*/
const address = program
.command('address')
.description('Check and fetch address info')
address
.command('list')
.option('-g, --garden', 'Show the now.garden directory')
.description('Show the address directory')
.action(addressDirectory)
address
.command('lookup <address>')
.description('Lookup info about an address')
.action(addressLookup)
/**
* PURLs
*/
const purl = program
.command('purl')
.description('Manage PURLs')
purl
.command('list')
.option('-a, --address [address]', 'Show PURLs for an address')
.description('List PURLs')
.action(purlList)
purl
.command('new')
.option('-l, --listed', 'Make the PURL public (default false)')
.argument('name')
.argument('url')
.description('Create a new PURL')
.action(purlNew)
purl
.command('delete <name>')
.description('Delete an existing PURL')
.action(purlDelete)
/**
* pastes
*/
const paste = program
.command('paste')
.description('Manage pastes')
paste
.command('list')
.option('-a, --address [address]', 'Show pastes for an address')
.description('List pastes')
.action(pasteList)
paste
.command('new')
.option('-l, --listed', 'Make the paste public (default false)')
.argument('title')
.argument('content')
.description('Create a new paste')
.action(pasteNew)
paste
.command('copy <name>')
.description('Copy the contents of a paste')
.action(pasteCopy)
paste
.command('delete <name>')
.description('Delete an existing paste')
.action(pasteDelete)
/**
* DNS
*/
const dns = program
.command('dns')
.description('Manage DNS records')
dns
.command('list')
.description('List your DNS records')
.action(dnsList)
program.parse()