diff --git a/kosmorro/__main__.py b/kosmorro/__main__.py index 84d46bd..197e315 100644 --- a/kosmorro/__main__.py +++ b/kosmorro/__main__.py @@ -298,8 +298,7 @@ def get_args(output_formats: [str]): default=None, choices=output_formats, help=_( - "The format to output the information to. If not provided, the output format " - "will be inferred from the file extension of the output file." + "The output format. If not provided, it will be inferred from the file extension of the output file." ), ) parser.add_argument( @@ -308,7 +307,7 @@ def get_args(output_formats: [str]): type=str, default=None, help=_( - 'The observer\'s position on Earth, in the "{latitude},{longitude}" format. ' + 'The observer\'s position on Earth, in the "latitude,longitude" format. ' "Can also be set in the KOSMORRO_POSITION environment variable." ), ) @@ -345,10 +344,7 @@ def get_args(output_formats: [str]): "-o", type=str, default=None, - help=_( - "A file to export the output to. If not given, the standard output is used. " - "This argument is needed for PDF format." - ), + help=_("Use this option to save the result in a file."), ) parser.add_argument( "--no-graph", diff --git a/kosmorro/locales/messages.pot b/kosmorro/locales/messages.pot index fca0dbf..e2d2373 100644 --- a/kosmorro/locales/messages.pot +++ b/kosmorro/locales/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2025-11-03 18:23+0100\n" +"POT-Creation-Date: 2025-11-09 11:42+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -79,25 +79,24 @@ msgstr "" #: kosmorro/__main__.py:301 msgid "" -"The format to output the information to. If not provided, the output " -"format will be inferred from the file extension of the output file." +"The output format. If not provided, it will be inferred from the file " +"extension of the output file." msgstr "" -#: kosmorro/__main__.py:311 -#, python-brace-format +#: kosmorro/__main__.py:310 msgid "" -"The observer's position on Earth, in the \"{latitude},{longitude}\" " -"format. Can also be set in the KOSMORRO_POSITION environment variable." +"The observer's position on Earth, in the \"latitude,longitude\" format. " +"Can also be set in the KOSMORRO_POSITION environment variable." msgstr "" -#: kosmorro/__main__.py:321 +#: kosmorro/__main__.py:320 msgid "" "The date for which the ephemerides must be calculated. Can be in the " "YYYY-MM-DD format or an interval in the \"[+-]YyMmDd\" format (with Y, M," " and D numbers). Defaults to current date." msgstr "" -#: kosmorro/__main__.py:332 +#: kosmorro/__main__.py:331 msgid "" "The timezone to use to display the hours. It can be either a number (e.g." " 1 for UTC+1) or a timezone name (e.g. Europe/Paris). See " @@ -105,31 +104,29 @@ msgid "" " timezone. Can also be set in the TZ environment variable." msgstr "" -#: kosmorro/__main__.py:341 +#: kosmorro/__main__.py:340 msgid "Disable the colors in the console." msgstr "" -#: kosmorro/__main__.py:349 -msgid "" -"A file to export the output to. If not given, the standard output is " -"used. This argument is needed for PDF format." +#: kosmorro/__main__.py:347 +msgid "Use this option to save the result in a file." msgstr "" -#: kosmorro/__main__.py:358 +#: kosmorro/__main__.py:354 msgid "" "Do not generate a graph to represent the rise and set times in the LaTeX " "or PDF file." msgstr "" -#: kosmorro/__main__.py:365 +#: kosmorro/__main__.py:361 msgid "Show debugging messages" msgstr "" -#: kosmorro/__main__.py:373 +#: kosmorro/__main__.py:369 msgid "Print a script allowing completion for your shell" msgstr "" -#: kosmorro/__main__.py:383 +#: kosmorro/__main__.py:379 msgid "No completion script available for this shell." msgstr "" diff --git a/manpage/kosmorro.1.md b/manpage/kosmorro.1.md index fbf0ddd..8b0ecee 100644 --- a/manpage/kosmorro.1.md +++ b/manpage/kosmorro.1.md @@ -29,12 +29,10 @@ disable the colors in the console `--output=`_OUTPUT_, `-o` _OUTPUT_ - a file to export the output to; if not given, the standard output is used + use this option to save the result in a file `--format=`_FORMAT_, `-f` _FORMAT_ (optional) - the format under which the information have to be output; one of the following: - text (plain text, like normal console output), json, tex (LaTeX), pdf. - If no format is provided, the output format will be inferred from the extension of the output file + The output format. If not provided, it will be inferred from the file extension of the output file `--no-graph` present the ephemerides in a table instead of a graph; PDF output format only diff --git a/tests/general.py b/tests/general.py index d36c5fd..36f2430 100644 --- a/tests/general.py +++ b/tests/general.py @@ -28,106 +28,3 @@ def test_run_without_argument(): assert stdout[-3] == "" assert stdout[-2] == "Note: All the hours are given in UTC." assert stdout[-1] == "" - - -def test_help_message(): - for arg in ["--help", "-h"]: - result = execute(KOSMORRO + [arg]) - - assert result.successful - - assert result.successful - - if python_version.major == 3 and python_version.minor < 13: - assert ( - result.stdout - == """usage: kosmorro [-h] [--version] [--format {txt,json,pdf,tex}] - [--position POSITION] [--date DATE] [--timezone TIMEZONE] - [--no-colors] [--output OUTPUT] [--no-graph] [--debug] - [--completion COMPLETION] - -Compute the ephemerides and the events for a given date and a given position -on Earth. - -options: - -h, --help show this help message and exit - --version, -v Show the program version - --format {txt,json,pdf,tex}, -f {txt,json,pdf,tex} - The format to output the information to. If not - provided, the output format will be inferred from the - file extension of the output file. - --position POSITION, -p POSITION - The observer's position on Earth, in the - "{latitude},{longitude}" format. Can also be set in - the KOSMORRO_POSITION environment variable. - --date DATE, -d DATE The date for which the ephemerides must be calculated. - Can be in the YYYY-MM-DD format or an interval in the - "[+-]YyMmDd" format (with Y, M, and D numbers). - Defaults to current date. - --timezone TIMEZONE, -t TIMEZONE - The timezone to use to display the hours. It can be - either a number (e.g. 1 for UTC+1) or a timezone name - (e.g. Europe/Paris). See https://en.wikipedia.org/wiki - /List_of_tz_database_time_zones to find your timezone. - Can also be set in the TZ environment variable. - --no-colors Disable the colors in the console. - --output OUTPUT, -o OUTPUT - A file to export the output to. If not given, the - standard output is used. This argument is needed for - PDF format. - --no-graph Do not generate a graph to represent the rise and set - times in the LaTeX or PDF file. - --debug Show debugging messages - --completion COMPLETION - Print a script allowing completion for your shell - -By default, only the events will be computed for today. To compute also the -ephemerides, latitude and longitude arguments are needed. -""" - ) - else: - assert ( - result.stdout - == """usage: kosmorro [-h] [--version] [--format {txt,json,pdf,tex}] - [--position POSITION] [--date DATE] [--timezone TIMEZONE] - [--no-colors] [--output OUTPUT] [--no-graph] [--debug] - [--completion COMPLETION] - -Compute the ephemerides and the events for a given date and a given position -on Earth. - -options: - -h, --help show this help message and exit - --version, -v Show the program version - --format, -f {txt,json,pdf,tex} - The format to output the information to. If not - provided, the output format will be inferred from the - file extension of the output file. - --position, -p POSITION - The observer's position on Earth, in the - "{latitude},{longitude}" format. Can also be set in - the KOSMORRO_POSITION environment variable. - --date, -d DATE The date for which the ephemerides must be calculated. - Can be in the YYYY-MM-DD format or an interval in the - "[+-]YyMmDd" format (with Y, M, and D numbers). - Defaults to current date. - --timezone, -t TIMEZONE - The timezone to use to display the hours. It can be - either a number (e.g. 1 for UTC+1) or a timezone name - (e.g. Europe/Paris). See https://en.wikipedia.org/wiki - /List_of_tz_database_time_zones to find your timezone. - Can also be set in the TZ environment variable. - --no-colors Disable the colors in the console. - --output, -o OUTPUT A file to export the output to. If not given, the - standard output is used. This argument is needed for - PDF format. - --no-graph Do not generate a graph to represent the rise and set - times in the LaTeX or PDF file. - --debug Show debugging messages - --completion COMPLETION - Print a script allowing completion for your shell - -By default, only the events will be computed for today. To compute also the -ephemerides, latitude and longitude arguments are needed. -""" - )