@@ -14,11 +14,12 @@ import { setLocale, t } from "./translations";
1414import { version } from "../package.json" ;
1515import { configInst } from "../config" ;
1616
17- const possibleActions = [
18- { value : "add" , label : t . ACTION_ADD , hint : "solid add ..." } ,
19- { value : "new" , label : t . ACTION_NEW , hint : "solid new ..." } ,
20- { value : "start" , label : t . ACTION_START , hint : "solid start ..." } ,
21- ] as const ;
17+ const possibleActions = ( ) =>
18+ [
19+ { value : "add" , label : t . ACTION_ADD , hint : "solid add ..." } ,
20+ { value : "new" , label : t . ACTION_NEW , hint : "solid new ..." } ,
21+ { value : "start" , label : t . ACTION_START , hint : "solid start ..." } ,
22+ ] as const ;
2223
2324export const provideStartSuggestions = async ( ) => {
2425 let startAction = await p . select ( {
@@ -51,11 +52,11 @@ export const provideStartSuggestions = async () => {
5152} ;
5253
5354const provideSuggestions = async ( ) => {
54- type ActionType = ( typeof possibleActions ) [ number ] [ "value" ] ;
55+ type ActionType = ReturnType < typeof possibleActions > [ number ] [ "value" ] ;
5556 let action = ( await p . select ( {
56- message : t . ACTION_START ,
57+ message : t . SELECT_ACTION ,
5758 // This thing really doesn't like `as const` things
58- options : possibleActions as any ,
59+ options : possibleActions ( ) as any ,
5960 } ) ) as ActionType ;
6061 if ( ! action ) return ;
6162 switch ( action ) {
@@ -72,13 +73,13 @@ const provideSuggestions = async () => {
7273} ;
7374
7475const main = async ( ) => {
76+ await configInst . parseConfig ( ) ;
77+ setLocale ( configInst . field ( "lang" ) ) ;
7578 const cli = subcommands ( {
7679 name : "solid" ,
7780 cmds : commands ,
7881 version : version ,
7982 } ) ;
80- await configInst . parseConfig ( ) ;
81- setLocale ( configInst . field ( "lang" ) ) ;
8283 p . intro ( `${ color . bgCyan ( color . black ( " Solid-CLI " ) ) } ` ) ;
8384 const args = process . argv . slice ( 2 ) ;
8485
0 commit comments