@@ -106,7 +106,7 @@ metadata.plugin = async function({__plugins, name, logger}) {
106106 }
107107 //Inputs checks
108108 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 } ] ) => [
110110 //Format key
111111 metadata . to . query ( key , { name} ) ,
112112 //Format value
@@ -269,25 +269,46 @@ metadata.plugin = async function({__plugins, name, logger}) {
269269 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>"
270270
271271 //Options table
272+ let flags = new Set ( )
272273 const table = [
273274 "| Option | Type *(format)* **[default]** *{allowed values}* | Description |" ,
274275 "| ------ | -------------------------------- | ----------- |" ,
275276 Object . entries ( inputs ) . map ( ( [ option , { description, type, ...o } ] ) => {
276277 let row = [ ]
277278 {
278- const cell = [ `${ "`" } ${ option } ${ "`" } ` ]
279+ let cell = [ ]
280+ if ( o . required )
281+ cell . push ( "✔️" ) , flags . add ( "required" )
279282 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" )
281290 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 } ${ "`" } ` )
283296 row . push ( cell . join ( " " ) )
284297 }
285298 {
286299 const cell = [ `${ "`" } ${ type } ${ "`" } ` ]
287300 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+ }
291312 if ( "values" in o )
292313 cell . push ( `*{${ o . values . map ( value => `"${ value } "` ) . join ( ", " ) } }*` )
293314 if ( "min" in o )
@@ -302,9 +323,14 @@ metadata.plugin = async function({__plugins, name, logger}) {
302323 return `| ${ row . join ( " | " ) } |`
303324 } ) . join ( "\n" ) ,
304325 "\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)" : "" ,
308334 ] . flat ( Infinity ) . filter ( s => s ) . join ( "\n" )
309335
310336 //Readme descriptor
0 commit comments