Conversation
|
Style |
|
Azure Pipelines successfully started running 2 pipeline(s). |
houk-ms
left a comment
There was a problem hiding this comment.
Good job ~
Can we also provide a simple developer doc later (may in another pr)?
| # https://python-prompt-toolkit.readthedocs.io/en/stable/pages/printing_text.html#style-text-tuples | ||
| formatted_parts = [] | ||
| for text in styled_text: | ||
| formatted_parts.append(THEME[text[0]] + text[1]) |
There was a problem hiding this comment.
key checking for THEME? Or add some error handling logics here?
There was a problem hiding this comment.
Nice catch. Added checks and tests as requested.
| short-summary: Upgrade Azure CLI and extensions | ||
| """ | ||
|
|
||
| helps['demo'] = """ |
There was a problem hiding this comment.
Just curious is this a convention to add a demo command here? The command is convenient for developers but also visible to users right?
There was a problem hiding this comment.
Just curious is this a convention to add a demo command here?
No. We don't have such convention. The only existing usage of this pattern is az self-test:
The command is convenient for developers but also visible to users right?
It is not visible to the user, as the parent command group has been marked as hide=True:
azure-cli/src/azure-cli/azure/cli/command_modules/util/commands.py
Lines 18 to 19 in bc2d0d4
| } | ||
|
|
||
|
|
||
| def print_styled_text(styled, file=sys.stderr): |
There was a problem hiding this comment.
May I ask why the default value of the file parameter is sys.stderr instead of sys.stdout?
There was a problem hiding this comment.
Only the JSON output should go to stdout and the user may pipe it to downstream commands. Per the description of stderr:
https://en.wikipedia.org/wiki/Standard_streams#sys.stderr
This is similar to sys.stdout because it also prints directly to the Console. But the difference is that can be used to print Exceptions and Error messages and also info/debugging comments. (Which is why it is called Standard Error). This can be very useful when the stdout is used to write data instead.
There was a problem hiding this comment.
As for az next, it is only used interactively, so the stream doesn't really matter as everything is printed to the screen.
Of course. I will add the doc once this feature is stabilized. |
zhoxing-ms
left a comment
There was a problem hiding this comment.
LGTM!
Maybe we can also encapsulate a util to reuse some common pattern prompts in the future, such as: TASK DONE: Style.SUCCESS + '(✓) Done:' + Style.PRIMARY + ...
Nice suggestion. Let's do this until there is some real usage so that the design/quality can be verified. |
| PRIMARY = "primary" | ||
| SECONDARY = "secondary" | ||
| IMPORTANT = "important" | ||
| ACTION = "action" # name TBD |
There was a problem hiding this comment.
@chenlomis, what style name should we use for light blue?
There was a problem hiding this comment.
Hi there
Am slightly confused
Did you mean finding an internal short name for the the bright blue?
https://devdivdesignguide.azurewebsites.net/command-line-interface/color-guidelines-for-command-line-interface/#action-colors
Description
Support style with color.
For a complete demo, see
src/azure-cli/azure/cli/command_modules/util/custom.pyand runaz demo style.