@@ -106,7 +106,7 @@ metadata.plugin = async function({__plugins, name, logger}) {
106
106
}
107
107
//Inputs checks
108
108
const result = Object . fromEntries (
109
- Object . entries ( inputs ) . map ( ( [ key , { type, format, default :defaulted , min, max, values} ] ) => [
109
+ Object . entries ( inputs ) . map ( ( [ key , { type, format, default :defaulted , min, max, values, inherits } ] ) => [
110
110
//Format key
111
111
metadata . to . query ( key , { name} ) ,
112
112
//Format value
@@ -269,25 +269,46 @@ metadata.plugin = async function({__plugins, name, logger}) {
269
269
const demo = raw . match ( / (?< demo > < t a b l e > [ \s \S ] * ?< [ / ] t a b l e > ) / ) ?. groups ?. demo ?. replace ( / < [ / ] ? (?: t a b l e | t r ) > / g, "" ) ?. trim ( ) ?? "<td></td>"
270
270
271
271
//Options table
272
+ let flags = new Set ( )
272
273
const table = [
273
274
"| Option | Type *(format)* **[default]** *{allowed values}* | Description |" ,
274
275
"| ------ | -------------------------------- | ----------- |" ,
275
276
Object . entries ( inputs ) . map ( ( [ option , { description, type, ...o } ] ) => {
276
277
let row = [ ]
277
278
{
278
- const cell = [ `${ "`" } ${ option } ${ "`" } ` ]
279
+ let cell = [ ]
280
+ if ( o . required )
281
+ cell . push ( "✔️" ) , flags . add ( "required" )
279
282
if ( type === "token" )
280
- cell . push ( "🔐" )
283
+ cell . push ( "🔐" ) , flags . add ( "secret" )
284
+ if ( o . inherits )
285
+ cell . push ( "⏩" ) , flags . add ( "inherits" )
286
+ if ( o . global )
287
+ cell . push ( "⏭️" ) , flags . add ( "global" )
288
+ if ( o . testing )
289
+ cell . push ( "🔧" ) , flags . add ( "testing" )
281
290
if ( ! Object . keys ( previous ?. inputs ?? { } ) . includes ( option ) )
282
- cell . push ( "✨" )
291
+ cell . push ( "✨" ) , flags . add ( "beta" )
292
+ if ( o . extras )
293
+ cell . push ( "🧰" ) , flags . add ( "extras" )
294
+ cell = cell . map ( flag => `<sup>${ flag } </sup>` )
295
+ cell . unshift ( `${ "`" } ${ option } ${ "`" } ` )
283
296
row . push ( cell . join ( " " ) )
284
297
}
285
298
{
286
299
const cell = [ `${ "`" } ${ type } ${ "`" } ` ]
287
300
if ( "format" in o )
288
- cell . push ( `*(${ o . format } )*` )
289
- if ( "default" in o )
290
- cell . push ( `**[${ o . default } ]**` )
301
+ cell . push ( `*(${ Array . isArray ( o . format ) ? o . format [ 0 ] : o . format } )*` )
302
+ if ( "default" in o ) {
303
+ let text = o . default
304
+ if ( o . default === ".user.login" )
305
+ text = "*→ User login*"
306
+ if ( o . default === ".user.twitter" )
307
+ text = "*→ User attached twitter*"
308
+ if ( o . default === ".user.website" )
309
+ text = "*→ User attached website*"
310
+ cell . push ( `**[${ text } ]**` )
311
+ }
291
312
if ( "values" in o )
292
313
cell . push ( `*{${ o . values . map ( value => `"${ value } "` ) . join ( ", " ) } }*` )
293
314
if ( "min" in o )
@@ -302,9 +323,14 @@ metadata.plugin = async function({__plugins, name, logger}) {
302
323
return `| ${ row . join ( " | " ) } |`
303
324
} ) . join ( "\n" ) ,
304
325
"\n" ,
305
- "Legend for option icons:" ,
306
- "* 🔐 Value should be stored in repository secrets" ,
307
- "* ✨ New feature currently in testing on `master`/`main`"
326
+ flags . size ? "Legend for option icons:" : "" ,
327
+ flags . has ( "required" ) ? "* ✔️ Value must be provided" : "" ,
328
+ flags . has ( "secret" ) ? "* 🔐 Value should be stored in repository secrets" : "" ,
329
+ flags . has ( "inherits" ) ? "* ⏩ Value inherits from its related global-level option" : "" ,
330
+ flags . has ( "global" ) ? "* ⏭️ Value be inherited by its related plugin-level option" : "" ,
331
+ flags . has ( "testing" ) ? "* 🔧 For development purposes, use with caution" : "" ,
332
+ flags . has ( "beta" ) ? "* ✨ Currently in beta-testing on `master`/`main`" : "" ,
333
+ flags . has ( "extras" ) ? "* 🧰 Must be enabled in `settings.json` (for web instances)" : "" ,
308
334
] . flat ( Infinity ) . filter ( s => s ) . join ( "\n" )
309
335
310
336
//Readme descriptor
0 commit comments