diff --git a/copernicusmarine/core_functions/credentials_utils.py b/copernicusmarine/core_functions/credentials_utils.py index dd870072..dd51b2db 100644 --- a/copernicusmarine/core_functions/credentials_utils.py +++ b/copernicusmarine/core_functions/credentials_utils.py @@ -91,7 +91,15 @@ def _load_credential_from_motu_configuration_file( def _retrieve_credential_from_prompt( credential_type: Literal["username", "password"], hide_input: bool ) -> str: - return click.prompt(credential_type, hide_input=hide_input) + if credential_type == "username": + logger.info( + "Downloading CMEMS data requires a Copernicus Marine username " + "and password, sign up for free at:" + " https://data.marine.copernicus.eu/register" + ) + return click.prompt( + "copernicusmarine " + credential_type, hide_input=hide_input + ) def _retrieve_credential_from_environment_variable( diff --git a/tests/test_command_line_interface.py b/tests/test_command_line_interface.py index 90b2542d..c70f8756 100644 --- a/tests/test_command_line_interface.py +++ b/tests/test_command_line_interface.py @@ -831,7 +831,12 @@ def test_login_is_prompt_when_configuration_file_doest_not_exist( command, env=environment_without_crendentials ) assert self.output.returncode == 1 - assert b"username:" in self.output.stdout + assert ( + b"Downloading CMEMS data requires a Copernicus Marine username " + b"and password, sign up for free at:" + b" https://data.marine.copernicus.eu/register" + ) in self.output.stderr + assert b"copernicusmarine username:" in self.output.stdout def test_login_command(self, tmp_path): self.check_credentials_username_specified_password_prompt(tmp_path)