Last active
April 3, 2023 13:22
-
-
Save chewhx/71983c2e999c2309919cf42988bde200 to your computer and use it in GitHub Desktop.
Initialise configurestore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export async function initConfig(keys: string[]) { | |
| for (const key of keys) { | |
| const hasKey = configstore.has(key); | |
| if (!hasKey) { | |
| const answer = await prompt([ | |
| { | |
| name: key, | |
| message: `Enter value for "${key}" config: `, | |
| type: 'input', | |
| }, | |
| ]); | |
| configstore.set(key, answer[key]); | |
| } | |
| } | |
| // Perhaps, insert a logger here: | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment