File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -79,8 +79,10 @@ function builder(argv: Argv): Argv<Options> {
7979
8080/** Yargs command handler for the command. */
8181async function handler ( options : Arguments < Options > ) {
82+ const apiKey = options . apiKey || DEFAULT_API_KEY ;
83+
8284 assert (
83- options . apiKey ,
85+ apiKey ,
8486 [
8587 'No API key configured. A Gemini API key must be set as the `GEMINI_API_KEY` environment ' +
8688 'variable, or passed in using the `--api-key` flag.' ,
@@ -89,7 +91,7 @@ async function handler(options: Arguments<Options>) {
8991 ) ;
9092
9193 const fixedContents = await fixFilesWithAI (
92- options . apiKey ,
94+ apiKey ,
9395 options . files ,
9496 options . error ,
9597 options . model ,
Original file line number Diff line number Diff line change @@ -72,15 +72,16 @@ function builder(argv: Argv): Argv<Options> {
7272 . option ( 'apiKey' , {
7373 type : 'string' ,
7474 alias : 'a' ,
75- default : DEFAULT_API_KEY ,
7675 description : 'API key used when making calls to the Gemini API' ,
7776 } ) ;
7877}
7978
8079/** Yargs command handler for the command. */
8180async function handler ( options : Arguments < Options > ) {
81+ const apiKey = options . apiKey || DEFAULT_API_KEY ;
82+
8283 assert (
83- options . apiKey ,
84+ apiKey ,
8485 [
8586 'No API key configured. A Gemini API key must be set as the `GEMINI_API_KEY` environment ' +
8687 'variable, or passed in using the `--api-key` flag.' ,
@@ -98,7 +99,7 @@ async function handler(options: Arguments<Options>) {
9899 process . exit ( 1 ) ;
99100 }
100101
101- const ai = new GoogleGenAI ( { apiKey : options . apiKey } ) ;
102+ const ai = new GoogleGenAI ( { apiKey} ) ;
102103 const progressBar = new SingleBar ( { } , Presets . shades_grey ) ;
103104 const failures : { name : string ; error : string } [ ] = [ ] ;
104105 const running = new Set < Promise < void > > ( ) ;
You can’t perform that action at this time.
0 commit comments