Skip to content

'az configure' experience (default output format) - #739

Merged
Derek Bekoe (derekbekoe) merged 4 commits into
Azure:masterfrom
derekbekoe:az-configure
Aug 26, 2016
Merged

Derek Bekoe (derekbekoe) merged 4 commits into
Azure:masterfrom
derekbekoe:az-configure

Conversation

@derekbekoe

@derekbekoe Derek Bekoe (derekbekoe) commented Aug 24, 2016

Copy link
Copy Markdown
Member

Fixes #657

  • Allows user to set default output type.
  • Infrastructure for CLI configurations also implemented.
$ az configure

Welcome to the Azure CLI! This command will guide you through logging in and setting some default values.

Your global settings can be found at /Users/derek/.azure/config
Your current environment settings can be found at /Users/derek/.azure/env_config/default
Your current configuration is as follows:

[core]
output = json

Environment variables:
AZURE_STORAGE_ACCOUNT = derekstorageaccount

Do you wish to change your global settings? (y/N): y
What default output format would you like?
 [1] json - JSON formatted output that most closely matches API responses
 [2] jsonc - Colored JSON formatted output that most closely matches API responses
 [3] table - Human-readable output format that focuses on clarity
 [4] tsv - Tab and Newline delimited, great for GREP, AWK, etc.
Please enter a choice [1]: 2

You're all set! Here are some commands to try:
 $ az vm create --help
 $ az feedback


Comment thread src/azure/cli/_config.py Outdated

@johanste Johan Stenberg (ex-msft) (johanste) Aug 24, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about y, n? #Resolved

@derekbekoe Derek Bekoe (derekbekoe) Aug 24, 2016

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the values used by the Python ConfigParser.
https://docs.python.org/2/library/configparser.html#ConfigParser.RawConfigParser.getboolean
https://github.com/python-git/python/blob/master/Lib/ConfigParser.py#L345

We can choose to support y, n if we want but it'd be a customization. #Resolved

@johanste Johan Stenberg (ex-msft) (johanste) Aug 24, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the user has to type these values, I vote for also supporting y and n. If this is just config file storage, I'm fine with it how it is.


In reply to: 76105114 [](ancestors = 76105114)

@derekbekoe Derek Bekoe (derekbekoe) Aug 25, 2016

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for a config file but is set by the user.
I'd like to keep the same options as the default Python ConfigParser. #Resolved

Comment thread src/azure/cli/_config.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing environment variables for storage do not use an AZURE_CLI prefix. They use AZURE_STORAGE_ and follow the names used by Xplat for cross-compatibility. If we can justify deviating from Xplat here then I'm fine with it--otherwise just prefix with AZURE_.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll switch to AZURE_ as the prefix.

- Allows user to set default output type.
- Infrastructure for CLI configurations also implemented.
@tjprescott

Copy link
Copy Markdown
Member

:shipit:

@mayurid

Copy link
Copy Markdown
Member

Derek Bekoe (@derekbekoe) : Should we have az login in the commands to try?

@derekbekoe

Copy link
Copy Markdown
Member Author

Mayuri Diwan (@mayurid) When the az configure command guides the user through logging in, they wouldn't need to run az login afterwards.

@derekbekoe
Derek Bekoe (derekbekoe) merged commit 7e2b7f8 into Azure:master Aug 26, 2016
@derekbekoe
Derek Bekoe (derekbekoe) deleted the az-configure branch August 26, 2016 21:17
Johan Stenberg (ex-msft) (johanste) added a commit that referenced this pull request Aug 31, 2016
* Provide support for reading a single parameter value from file

Values prefixed with @ will be replaced with the content of the file immediately following the @-sign.

The pseudo-name '-' is used to indicate stdin.

* Fix accidentally deleted space (which made pylint angry)

* enable diagnostics and extensions in vmss profile (#737)

* Expose generic update parameters on existing custom updates (#735)

* Convert all updates to cli_generic_update_commands.

* Code review fixes.

* Remove inline CliArgumentType(...) registrations (#744)

* Eliminates anti-pattern of creating CliArgumentTypes inline during parameter registration.

* Minor fixes.

* Add NAT Rules to VMSS create that allow SSH/RDP by default (#743)

* Update regular expression to fix issue #147 (#747)

* Support colored output on Windows (#756)

* [Help] Help Fixes and Enhancements (#736)

* Fix issue #680.

* Initial version of help dump. Logic to extract summary.

* Fix issues #365 and #447.

* Code review fixes.

* Code review fixes.

* Fix folded parameter logic to make new optional. Update existing uses to (#766)

work with new logic.

* Treat CloudError like a CLIError (don't print stack trace) (#759)

* 'az configure' experience (default output format) (#739)

* 'az configure' experience

- Allows user to set default output type.
- Infrastructure for CLI configurations also implemented.

* Add license header & fix deprecated method

* Wrap SafeConfigParser instead of extending from it

* Code review feedback changes

* Table format revisions (#748)

* Table format revisions

- Table output is generic and automatically extracts fields from the result.
- No longer use simple_output_query as it was specific for commands and as packages will support multiple API versions, this solution is no longer feasible.

* Support callable again for table format after discussion

When a callable is set for a command, it will be used as long as there is no query active.
If there's a query active, the callable will not be used so the user has to specify a full query that can generate an appropriate table.

* Remove 'starting' message for long running operations (#767)

* Remove 'starting' message for long running operations

* Change name of poll_interval_ms as ambiguous and also change logger messages that referred to this interval

* Catch EOF to minimize stack trace craziness. (#768)

* Change simple_output_query to be table_transformer (#771)

* [Resource] Resource Tag Fix (issue 763) (#765)

* Use 'ignore_type' within resource module. Fix issue 763.

* Code review fixes.

* Only delete certain files in yml output folder during Document CI (#762)

* Update README Docker instructions. (#776)

* Fixes #772 (#779)

* Handle BrokenPipeError (#775)

* Fix issue 770.

* Fix undeclared-variable

* update a few command descriptions (#781)

* VM issue: fix #749, #753, #575 (#778)

* Add commands for Azure IoT (#730)

* Add commands for Azure IoT

* 1.Include files into azure-cli.pyproj; 2. Update license info in setup.py

* add missing pylint directive

* resolve review comments

* resolve comments

* fix typo

* [Document CI] Handle Robocopy exit code (#786)

* Generic Update enhancements. (#740)

* Fix issues #728 and #686

* Code review fixes.

* Fix Error if Non-existent Storage Account Specified (#787)

* Fix issue #784.

* Code review fix.

* vm: enable autoUpgradeMinorVersion by default (#791)

* cmd: use plurals for list-* command naming (#792)

Committer: yugangw-msft

* Ensure docstring help with unrecognized unicode characters still displays correctly. (#795)

* Provide support for reading a single parameter value from file

Values prefixed with @ will be replaced with the content of the file immediately following the @-sign.

The pseudo-name '-' is used to indicate stdin.

* Fix accidentally deleted space (which made pylint angry)
Kerwin(Kaihui) Sun (00Kai0) pushed a commit to 00Kai0/azure-cli that referenced this pull request Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants