0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-20 21:32:31 -05:00

fix: support capital letter "Y" in command line prompt

This commit is contained in:
Charles Zhao 2022-09-13 18:52:46 +08:00
parent 443f45ed2e
commit 416f4e86e3
No known key found for this signature in database
GPG key ID: 4858774754C92DF2
2 changed files with 3 additions and 2 deletions

View file

@ -19,7 +19,7 @@ const question = async (query) => new Promise((resolve) => {
const confirm = async (query) => {
const answer = await question(`${query} (Y/n) `);
return answer === '' || ['y', 'yes', 'yep', 'yeah'].includes(answer);
return answer === '' || ['y', 'yes', 'yep', 'yeah'].includes(answer.toLowerCase());
};
const safeExecSync = (command) => {

View file

@ -1,6 +1,7 @@
import { getEnv } from '@silverhand/essentials';
export const isTrue = (value: string) => ['1', 'true', 'y', 'yes', 'yep', 'yeah'].includes(value);
export const isTrue = (value: string) =>
['1', 'true', 'y', 'yes', 'yep', 'yeah'].includes(value.toLowerCase());
const parameters = new Set(process.argv.slice(2));
export const noInquiry = parameters.has('--no-inquiry') || isTrue(getEnv('NO_INQUIRY'));