tayganr / purviewcli

Microsoft Purview CLI
https://aka.ms/purviewcli
MIT License
48 stars 27 forks source link

Allow PURVIEW_NAME input as flag #7

Closed th0ger closed 3 years ago

th0ger commented 3 years ago

It would be syntactically simpler if we could use --purviewName as an alternative to the mandatory PURVIEW_NAME environment variable.

(I'm sure the a technicalities why it's an env variable, but from user perspective it's not obvious.)

tayganr commented 3 years ago

Thanks th0ger. PURVIEW_NAME (along with AZURE_CLIENT_ID, AZURE_TENANT_ID, and AZURE_CLIENT_SECRET) are environment variables as opposed to command line arguments to avoid the need to repeatedly provide their values when executing multiple purviewcli commands in succession.

th0ger commented 3 years ago

Hi @tayganr ,

I think that's a matter of preference. I prefer to not use application-specific environment variables in my shell, because it keeps some state hanging indefinitely. I may forget to change the variable, or what it was called. What I currently do, is spawn a subshell, set the env. variable and launch purviewcli. But that is really clunky.

Good CLIs let users decide if they want to pass input via flags, environment variables, a config file (or combination of these). The CLI defines an order of precedence for those inputs.

tayganr commented 3 years ago

Thanks @th0ger. Just updated purviewcli (0.1.15). Now includes an optional argument --purviewName for each command which will take precedence over the environment variable.