Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/azure-cli-core/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Release History
===============

* Plug in HaTS survey

2.0.77
++++++
* Add deprecate message for Python 2.7
Expand Down
3 changes: 3 additions & 0 deletions src/azure-cli-core/azure/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def get_cli_version(self):

def show_version(self):
from azure.cli.core.util import get_az_version_string
from azure.cli.core.commands.constants import SURVEY_PROMPT
ver_string, updates_available = get_az_version_string()
print(ver_string)
if updates_available == -1:
Expand All @@ -96,6 +97,8 @@ def show_version(self):
else:
print('Your CLI is up-to-date.')

print('\n' + SURVEY_PROMPT)

def exception_handler(self, ex): # pylint: disable=no-self-use
from azure.cli.core.util import handle_exception
return handle_exception(ex)
Expand Down
2 changes: 2 additions & 0 deletions src/azure-cli-core/azure/cli/core/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import argparse

from azure.cli.core.commands import ExtensionCommandSource
from azure.cli.core.commands.constants import SURVEY_PROMPT

from knack.help import (HelpFile as KnackHelpFile, CommandHelpFile as KnackCommandHelpFile,
GroupHelpFile as KnackGroupHelpFile, ArgumentGroupRegistry as KnackArgumentGroupRegistry,
Expand Down Expand Up @@ -150,6 +151,7 @@ def new_normalize_text(s):
def show_help(self, cli_name, nouns, parser, is_group):
self.update_loaders_with_help_file_contents(nouns)
super(AzCliHelp, self).show_help(cli_name, nouns, parser, is_group)
print(SURVEY_PROMPT)
Copy link
Member

Choose a reason for hiding this comment

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

each time when typing "-h", print this prompt?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, that's by design.

Copy link
Member

Choose a reason for hiding this comment

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

Will users be bothered? Reduce frequency?

Copy link
Member Author

Choose a reason for hiding this comment

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

Originally, we thought of providing an option to turn the survey prompt off. But since users can just ignore it, let's just leave it there and see how it goes. We can improve this when we have more feedback.

Copy link

Choose a reason for hiding this comment

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

Hi there!

Please consider this as feedback that this is kind of annoying :) Especially since that's a coloured prompt (whereas the actual help text is not).

I've filled in the survey… but I could only select "neither good nor bad" for all entries, as I've just started using the CLI (which is why I'm looking at the help).

Sorry for intruding on your PR, I'll go back to being quiet now, thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the feedback. We'll look at then.


def _register_help_loaders(self):
import azure.cli.core._help_loaders as help_loaders
Expand Down
2 changes: 2 additions & 0 deletions src/azure-cli-core/azure/cli/core/_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ def find_from_user_account(self, username, password, tenant, resource):
return result

def find_through_authorization_code_flow(self, tenant, resource, authority_url):
from azure.cli.core.commands.constants import SURVEY_PROMPT
# launch browser and get the code
results = _get_authorization_code(resource, authority_url)

Expand All @@ -793,6 +794,7 @@ def find_through_authorization_code_flow(self, tenant, resource, authority_url):
token_entry = context.acquire_token_with_authorization_code(results['code'], results['reply_url'],
resource, _CLIENT_ID, None)
self.user_id = token_entry[_TOKEN_ENTRY_USER_ID]
print(SURVEY_PROMPT + "\n")
logger.warning("You have logged in. Now let us find all the subscriptions to which you have access...")
if tenant is None:
result = self._find_using_common_tenant(token_entry[_ACCESS_TOKEN], resource)
Expand Down
4 changes: 4 additions & 0 deletions src/azure-cli-core/azure/cli/core/commands/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from colorama import Fore, Style
from knack.parser import ARGPARSE_SUPPORTED_KWARGS


Expand All @@ -29,3 +30,6 @@
DEFAULT_QUERY_TIME_RANGE = 3600000

BLACKLISTED_MODS = ['context', 'shell', 'documentdb', 'component']

SURVEY_PROMPT = Fore.YELLOW + Style.BRIGHT + 'Please let us know how we are doing: ' + Fore.BLUE \
Copy link
Member

Choose a reason for hiding this comment

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

Starting with "Please" looks like a command. Maybe the prompt can be more friendly.

Copy link
Member Author

Choose a reason for hiding this comment

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

IMHO, using "Please" is kind of friendly.

+ 'https://aka.ms/clihats' + Style.RESET_ALL
1 change: 1 addition & 0 deletions src/azure-cli/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Release History
**Core**

* Remove support for Python 3.4
* Plug in HaTS survey in multiple commands

**Install**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from azure.cli.core.extension._resolve import resolve_project_url_from_index, NoExtensionCandidatesError
from azure.cli.core.util import get_az_version_string, open_page_in_browser, can_launch_browser, in_cloud_console
from azure.cli.core.azlogging import _UNKNOWN_COMMAND, _CMD_LOG_LINE_PREFIX
from azure.cli.core.commands.constants import SURVEY_PROMPT

_ONE_MIN_IN_SECS = 60

Expand All @@ -50,7 +51,8 @@
'\nWe appreciate your feedback!\n\n' \
'For more information on getting started, visit: {}\n' \
'If you have questions, visit our Stack Overflow page: {}\n'\
.format(_GET_STARTED_URL, _QUESTIONS_URL)
'{}\n'\
.format(_GET_STARTED_URL, _QUESTIONS_URL, SURVEY_PROMPT)

_MSG_CMD_ISSUE = "\nEnter the number of the command you would like to create an issue for. Enter q to quit: "

Expand Down
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/find/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from azure.cli.core import telemetry as telemetry_core
from azure.cli.core import __version__ as core_version
from azure.cli.core.commands.constants import SURVEY_PROMPT
from pkg_resources import parse_version
from knack.log import get_logger
logger = get_logger(__name__)
Expand Down Expand Up @@ -65,6 +66,7 @@ def process_query(cli_term):
if has_pruned_answer:
print(style_message("More commands and examples are available in the latest version of the CLI. "
"Please update for the best experience.\n"))
print(SURVEY_PROMPT)


def style_message(msg):
Expand Down