pnp/cli-microsoft365

Centralise default config values

Aperta

#6186 aperta il 27 lug 2024

 (5 commenti) (0 reazioni) (0 assegnatari)TypeScript (399 fork)auto 404
enhancementhelp wantedkeep-open

Metriche repository

Star
 (1390 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

In a lot of commands, we retrieve config values as follows:

cli.getSettingWithDefaultValue<boolean>(settingsNames.autoOpenLinksInBrowser, false)

I don't think it's a good approach to define the default value in the command itself. A better approach would be that we centralize all default values and provide a new function where the user should only specify the config variable. E.g.:

cli.getSetting<boolean>(settingsNames.autoOpenLinksInBrowser)

Guida contributor