File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -37,5 +37,33 @@ export const defineBuiltinRoutes = <Routes extends ObjectType<any>>(r: ObjectVal
3737 } ;
3838 } ,
3939 ) ,
40+
41+ r (
42+ '.methods' ,
43+ t . Function ( t . undef , t . Array ( t . str ) ) . options ( {
44+ title : 'List all CLI methods' ,
45+ description : 'Returns a list of all methods available in this CLI.' ,
46+ } ) ,
47+ async ( request , ctx ) => {
48+ const list = ( ctx as CliContext ) . cli . router . keys ( ) ;
49+ return list ;
50+ } ,
51+ ) ,
52+
53+ r (
54+ '.method' ,
55+ t . Function ( t . Object (
56+ t . prop ( 'name' , t . str )
57+ ) , t . any ) . options ( {
58+ title : 'Show method information' ,
59+ description : 'Returns JSON Type schema of the method.' ,
60+ } ) ,
61+ async ( request , ctx ) => {
62+ const name = request . name ;
63+ const method = ( ctx as CliContext ) . cli . router . get ( name ) ;
64+ if ( ! method ) throw new Error ( `Unknown method "${ name } "` ) ;
65+ return method . type . getSchema ( ) ;
66+ } ,
67+ ) ,
4068 ] ) ;
4169} ;
Original file line number Diff line number Diff line change 4141 ${ cmd } <method> '<json>'
4242 ${ cmd } <method> --<type><pointer>=<value>
4343 echo '<json>' | ${ cmd } <method>
44+ ${ cmd } .methods
45+ ${ cmd } .method --s/name=<method>
4446
4547Examples:
4648
You can’t perform that action at this time.
0 commit comments