Selaa lähdekoodia

fix: fix documentation

tags/v1.0.0rc3
Jérôme Deuchnord 3 viikkoa sitten
vanhempi
commit
c4359dc67e
4 muutettua tiedostoa jossa 20 lisäystä ja 132 poistoa
  1. +3
    -7
      kosmorro/__main__.py
  2. +15
    -18
      kosmorro/locales/messages.pot
  3. +2
    -4
      manpage/kosmorro.1.md
  4. +0
    -103
      tests/general.py

+ 3
- 7
kosmorro/__main__.py Näytä tiedosto

@@ -298,8 +298,7 @@ def get_args(output_formats: [str]):
default=None, default=None,
choices=output_formats, choices=output_formats,
help=_( 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( parser.add_argument(
@@ -308,7 +307,7 @@ def get_args(output_formats: [str]):
type=str, type=str,
default=None, default=None,
help=_( 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." "Can also be set in the KOSMORRO_POSITION environment variable."
), ),
) )
@@ -345,10 +344,7 @@ def get_args(output_formats: [str]):
"-o", "-o",
type=str, type=str,
default=None, 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( parser.add_argument(
"--no-graph", "--no-graph",


+ 15
- 18
kosmorro/locales/messages.pot Näytä tiedosto

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -79,25 +79,24 @@ msgstr ""


#: kosmorro/__main__.py:301 #: kosmorro/__main__.py:301
msgid "" 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 "" msgstr ""


#: kosmorro/__main__.py:311
#, python-brace-format
#: kosmorro/__main__.py:310
msgid "" 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 "" msgstr ""


#: kosmorro/__main__.py:321
#: kosmorro/__main__.py:320
msgid "" msgid ""
"The date for which the ephemerides must be calculated. Can be in the " "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," "YYYY-MM-DD format or an interval in the \"[+-]YyMmDd\" format (with Y, M,"
" and D numbers). Defaults to current date." " and D numbers). Defaults to current date."
msgstr "" msgstr ""


#: kosmorro/__main__.py:332
#: kosmorro/__main__.py:331
msgid "" msgid ""
"The timezone to use to display the hours. It can be either a number (e.g." "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 " " 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." " timezone. Can also be set in the TZ environment variable."
msgstr "" msgstr ""


#: kosmorro/__main__.py:341
#: kosmorro/__main__.py:340
msgid "Disable the colors in the console." msgid "Disable the colors in the console."
msgstr "" 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 "" msgstr ""


#: kosmorro/__main__.py:358
#: kosmorro/__main__.py:354
msgid "" msgid ""
"Do not generate a graph to represent the rise and set times in the LaTeX " "Do not generate a graph to represent the rise and set times in the LaTeX "
"or PDF file." "or PDF file."
msgstr "" msgstr ""


#: kosmorro/__main__.py:365
#: kosmorro/__main__.py:361
msgid "Show debugging messages" msgid "Show debugging messages"
msgstr "" msgstr ""


#: kosmorro/__main__.py:373
#: kosmorro/__main__.py:369
msgid "Print a script allowing completion for your shell" msgid "Print a script allowing completion for your shell"
msgstr "" msgstr ""


#: kosmorro/__main__.py:383
#: kosmorro/__main__.py:379
msgid "No completion script available for this shell." msgid "No completion script available for this shell."
msgstr "" msgstr ""




+ 2
- 4
manpage/kosmorro.1.md Näytä tiedosto

@@ -29,12 +29,10 @@
disable the colors in the console disable the colors in the console


`--output=`_OUTPUT_, `-o` _OUTPUT_ `--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) `--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` `--no-graph`
present the ephemerides in a table instead of a graph; PDF output format only present the ephemerides in a table instead of a graph; PDF output format only


+ 0
- 103
tests/general.py Näytä tiedosto

@@ -28,106 +28,3 @@ def test_run_without_argument():
assert stdout[-3] == "" assert stdout[-3] == ""
assert stdout[-2] == "Note: All the hours are given in UTC." assert stdout[-2] == "Note: All the hours are given in UTC."
assert stdout[-1] == "" 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.
"""
)

Ladataan…
Peruuta
Tallenna