From 7034c44376ff86d3094b665790139c3133ada423 Mon Sep 17 00:00:00 2001 From: Mark Anderson Date: Mon, 23 Mar 2026 14:23:56 -0400 Subject: [PATCH] Revert "fix: make 'android-lang' optional, with java as default (#149)" This reverts commit c2274d040810f5b31479f7073b19fa293d057c7a. --- README.md | 2 +- src/help.ts | 2 +- src/options.ts | 16 ++-------------- src/prompt.ts | 15 +++++++++------ 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 148a2de..dd029a1 100644 --- a/README.md +++ b/README.md @@ -30,5 +30,5 @@ As of the `0.8.0` release, example apps for testing are included when initializi --author ......... Author name and email (e.g. "Name ") --license ............ SPDX License ID (e.g. "MIT") --description ...... Short description of plugin features ---android-lang ..... Language for Android plugin development (either "kotlin" or "java", default is "java") +--android-lang ..... Language for Android plugin development (either "kotlin" or "java") ``` diff --git a/src/help.ts b/src/help.ts index 726ff7f..df38983 100644 --- a/src/help.ts +++ b/src/help.ts @@ -10,7 +10,7 @@ const help = ` --author ......... Author name and email (e.g. "Name ") --license ............ SPDX License ID (e.g. "MIT") --description ...... Short description of plugin features - --android-lang ............ Language for Android plugin development (either "kotlin" or "java", default is "java") + --android-lang ............ Language for Android plugin development (either "kotlin" or "java") -h, --help ................ Print help, then quit --verbose ................. Print verbose output to stderr diff --git a/src/options.ts b/src/options.ts index 7f296a0..e15a25d 100644 --- a/src/options.ts +++ b/src/options.ts @@ -68,7 +68,7 @@ export const VALIDATORS: Validators = { description: (value) => typeof value !== 'string' || value.trim().length === 0 ? `Must provide a description` : true, 'android-lang': (value) => - value === undefined || value === '' || (typeof value === 'string' && /^(kotlin|java)$/i.test(value)) + typeof value === 'string' && value.trim().length > 0 && /^(kotlin|kt|java)$/i.test(value) ? true : `Must be either "kotlin" or "java"`, dir: (value) => @@ -99,12 +99,6 @@ export const getOptions = (): Options => { if (typeof validatorResult === 'string') { debug(`invalid option: --%s %O: %s`, option, value, validatorResult); - - // 'android-lang' is not prompted, so it should fail if invalid - if (option === 'android-lang') { - process.stderr.write(`ERR: Invalid --android-lang value "${value}": ${validatorResult}\n`); - process.exit(1); - } } opts[option] = validatorResult === true ? value : undefined; @@ -112,11 +106,5 @@ export const getOptions = (): Options => { return opts; }, {} as Options); - const allOptions = { ...argValues, ...optionValues }; - - if (!allOptions['android-lang']) { - allOptions['android-lang'] = 'java'; - } - - return allOptions; + return { ...argValues, ...optionValues }; }; diff --git a/src/prompt.ts b/src/prompt.ts index 4fb5b75..3249d95 100644 --- a/src/prompt.ts +++ b/src/prompt.ts @@ -82,6 +82,15 @@ export const gatherDetails = (initialOptions: Options): Promise => message: `Enter a SPDX license identifier for your plugin.\n`, validate: VALIDATORS.license, }, + { + type: 'select', + name: 'android-lang', + message: `What language would you like to use for your Android plugin?\n`, + choices: [ + { title: 'Kotlin', value: 'kotlin' }, + { title: 'Java', value: 'java' }, + ], + }, { type: 'text', name: 'description', @@ -96,11 +105,5 @@ export const gatherDetails = (initialOptions: Options): Promise => process.exit(1); }, }, - ).then( - (result) => - ({ - ...result, - 'android-lang': initialOptions['android-lang'], - }) as OptionValues, ); };