File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,16 @@ interface NotificationOptions {
11
11
avatar ?: boolean
12
12
image ?: boolean
13
13
count ?: number
14
+ // TODO move to global options
15
+ raw ?: number
16
+ pretty ?: number
14
17
}
15
18
16
19
export const msg = createCommand ( 'msg' )
17
20
. description ( 'display notifications' )
18
21
. aliases ( [ 'message' , 'notification' ] )
22
+ . option ( '-r, --raw' , 'output raw data' , false )
23
+ . option ( '-p, --pretty' , 'format raw data' , false )
19
24
. option ( '--no-avatar' , 'do not show avatar' )
20
25
. option ( '--no-image' , 'do not show image' )
21
26
. option ( '-c, --count <count>' , 'notification max count' , '30' )
@@ -46,6 +51,13 @@ const showNotifications = async (opts: NotificationOptions) => {
46
51
47
52
logger . success ( 'Loading notifications done!' )
48
53
54
+ if ( opts . raw ) {
55
+ process . stdout . write (
56
+ `${ JSON . stringify ( notifications , null , opts . pretty ? 2 : 0 ) } \n`
57
+ )
58
+ return
59
+ }
60
+
49
61
{
50
62
const divider = logger . colors . gray ( '─' . repeat ( process . stdout . columns || 30 ) )
51
63
You can’t perform that action at this time.
0 commit comments