Skip to content

[Help] Help Fixes and Enhancements - #736

Merged
Travis Prescott (tjprescott) merged 5 commits into
Azure:masterfrom
tjprescott:HelpBugsSprint2
Aug 25, 2016
Merged

Travis Prescott (tjprescott) merged 5 commits into
Azure:masterfrom
tjprescott:HelpBugsSprint2

Conversation

@tjprescott

@tjprescott Travis Prescott (tjprescott) commented Aug 23, 2016

Copy link
Copy Markdown
Member

This PR fixes #365, fixes #447 and fixes #680. The first sentence of the docstring will be parsed as the short description and any subsequent sentences will be parsed as the long description. This largely takes care of issue #707 (although it doesn't address how adequate the reflected help is). Of course, you can override any of this through the YAML help file.

Additionally, this PR fixes an issue where choice lists would appear in random order in help.

@tjprescott

Travis Prescott (tjprescott) commented Aug 23, 2016

Copy link
Copy Markdown
Member Author

As an example for az vm -h

Group
    az vm

Subgroups:
    ...

Commands:
    capture               : Captures the VM by copying virtual hard disks of the VM and outputs a
                            template that can be used to create similar VMs.
    create                : Create an Azure Virtual Machine.
    deallocate            : Shuts down the Virtual Machine and releases the compute resources.
    delete                : The operation to delete a virtual machine.
    generalize            : Sets the state of the VM as Generalized.
    get-instance-view
    list                  : List Virtual Machines.
    list-ip-addresses     : Get IP addresses from one or more Virtual Machines.
    list-sizes            : Lists all available virtual machine sizes for a subscription in a
                            location.
    list-usage            : Lists compute usages for a subscription.
    list-vm-resize-options: Lists all available virtual machine sizes it can be resized to for a
                            virtual machine.
    open-port             : Opens a VM to all inbound traffic and protocols by adding a security
                            rule to the network security group (NSG) that is attached to the VM's
                            network interface (NIC) or subnet.
    redeploy              : The operation to redeploy a virtual machine.
    resize                : Update vm size.
    restart               : The operation to restart a virtual machine.
    show                  : The operation to get a virtual machine.
    start                 : The operation to start a virtual machine.
    stop                  : The operation to power off (stop) a virtual machine.
    update                : Update VM properties.
``` #ByDesign

@johanste Johan Stenberg (ex-msft) (johanste) Aug 23, 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.

We should not compile a regex for each command we register. Performance.

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.

the regex can be pulled out of the method and compiled, then using the precompiled version will be faster


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

@tjprescott

Travis Prescott (tjprescott) commented Aug 23, 2016

Copy link
Copy Markdown
Member Author

Command

Also, I will get getting rid of this file before I merge. I used it to diff and make sure my changes for fixing the issue with : didn't break other things. #Resolved


Refers to: help_dump.txt:2 in 0d7d269. [](commit_id = 0d7d26977e1a5d6f36d5aea5cdcd3034e03f5504, deletion_comment = False)

@tjprescott Travis Prescott (tjprescott) added this to the Sprint 2 milestone Aug 23, 2016
@BurtBiel

Burt Bielicki (BurtBiel) commented Aug 24, 2016

Copy link
Copy Markdown
Contributor
                  max_name_length + indent*4 + 2)

let's factor this and the version in your code out into a helper method like _get_hanging_indent. We might as well add a comment in that method or a constant for why we do the +2 (for the colon + space) #Resolved


Refers to: src/azure/cli/_help.py:106 in 0d7d269. [](commit_id = 0d7d26977e1a5d6f36d5aea5cdcd3034e03f5504, deletion_comment = False)

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

@BurtBiel Burt Bielicki (BurtBiel) 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.

self.long_summary = None [](start = 12, length = 24)

technically don't need this #Resolved

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.

Good point. I had it the other way around originally but that caused the help tests to fail, so I changed it to conform to the tests. Unit test win.


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

@tjprescott

Travis Prescott (tjprescott) commented Aug 24, 2016

Copy link
Copy Markdown
Member Author

Johan Stenberg (ex-msft) (@johanste) Burt Bielicki (@BurtBiel) comments addressed. #Closed

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

@BurtBiel Burt Bielicki (BurtBiel) 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.

nit: this could be moved next to get column indent since they are closely related #Resolved

@tjprescott

Copy link
Copy Markdown
Member Author

Burt Bielicki (@BurtBiel) comments addressed. #Closed

@tjprescott
Travis Prescott (tjprescott) merged commit 18a48e6 into Azure:master Aug 25, 2016
@tjprescott
Travis Prescott (tjprescott) deleted the HelpBugsSprint2 branch August 25, 2016 21:51
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.

5 participants