blob: 71fd83c24f8416d57db00328aba132c5921b74bf (
plain)
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
|
;;;; account.lisp
(in-package :oneliners.cli.app )
(defhandler account/login/handler (username password)
(ol:login username password))
(defun account/login/command ()
(cli:make-command
:name "login"
:usage "<USERNAME> <PASSWORD>"
:description "obtains an API access key and stores it locally"
:handler #'account/login/handler))
(defun account/logout/handler (cmd)
(declare (ignore cmd))
(ol:revoke-access))
(defun account/logout/command ()
(cli:make-command
:name "logout"
:description "revokes access for the currently stored key"
:handler #'account/logout/handler))
(defun account/signature/handler (cmd)
(declare (ignore cmd))
(ol:change-signature))
(defun account/signature/command ()
(cli:make-command
:name "signature"
:description "a signature is text users seen when they do `ol account whois <you>`"
:handler #'account/signature/handler))
(defhandler account/password/handler (old new)
(ol:change-pw old new new))
(defun account/password/command ()
(cli:make-command
:name "password"
:usage "<OLDPW> <NEWPW>"
:description "change your password"
:handler #'account/password/handler))
(defhandler account/whois/handler (nick)
(ol:show-contributor nick))
(defun account/whois/command ()
(cli:make-command
:name "whois"
:description "View the user's signature, if they have one."
:handler #'account/whois/handler))
(defun account/invite/handler (cmd)
(declare (ignore cmd))
(ol:request-invite-code))
(defun account/invite/command ()
(cli:make-command
:name "invite"
:description "request an invite token from the server"
:handler #'account/invite/handler))
(defhandler account/redeem/handler (token name password)
(ol:redeem-invite token name password))
(defun account/redeem/command ()
(cli:make-command
:name "redeem"
:usage "<TOKEN> <NEW-USERNAME> <NEW-PASSWORD>"
:handler #'account/redeem/handler
:description "redeem an invite token to create a new contributor account"))
(defun account/subcommands ()
(list
(account/login/command)
(account/logout/command)
(account/signature/command)
(account/password/command)
(account/whois/command)
(account/invite/command)
(account/redeem/command)))
(defun account/handler (cmd)
(cli:print-usage cmd t))
(defun account/command ()
(cli:make-command
:name "account"
:description "commands having to do with user accounts"
:handler #'account/handler
:sub-commands (account/subcommands)))
|