Browse Source

docs: update the manpage

pull/191/head
Jérôme Deuchnord 4 years ago
parent
commit
724f704266
5 changed files with 47 additions and 45 deletions
  1. +8
    -4
      _kosmorro/geolocation.py
  2. +32
    -29
      _kosmorro/locales/messages.pot
  3. +2
    -2
      _kosmorro/main.py
  4. +4
    -10
      manpage/kosmorro.1.md
  5. +1
    -0
      setup.py

+ 8
- 4
_kosmorro/geolocation.py View File

@@ -13,9 +13,9 @@ def _parse_latitude_longitude(from_str: str) -> Position:
if not re.search(r"^([\d.-]+)[,;]([\d.-]+)$", from_str): if not re.search(r"^([\d.-]+)[,;]([\d.-]+)$", from_str):
raise ValueError(_("The given position (%s) is not valid." % from_str)) raise ValueError(_("The given position (%s) is not valid." % from_str))


latitude_longitude = from_str.split(';')
latitude_longitude = from_str.split(";")
if len(latitude_longitude) == 1: if len(latitude_longitude) == 1:
latitude_longitude = from_str.split(',')
latitude_longitude = from_str.split(",")


return Position(float(latitude_longitude[0]), float(latitude_longitude[1])) return Position(float(latitude_longitude[0]), float(latitude_longitude[1]))


@@ -25,13 +25,17 @@ def _parse_plus_code(from_str: str) -> Union[None, Position]:
return None return None


if not openlocationcode.isFull(from_str): if not openlocationcode.isFull(from_str):
raise ValueError(_('The given Plus Code seems to be a short code, please provide a full code.'))
raise ValueError(
_(
"The given Plus Code seems to be a short code, please provide a full code."
)
)


pos = openlocationcode.decode(from_str) pos = openlocationcode.decode(from_str)


return Position( return Position(
latitude=(pos.latitudeLo + pos.latitudeHi) / 2, latitude=(pos.latitudeLo + pos.latitudeHi) / 2,
longitude=(pos.longitudeLo + pos.longitudeHi) / 2
longitude=(pos.longitudeLo + pos.longitudeHi) / 2,
) )






+ 32
- 29
_kosmorro/locales/messages.pot View File

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: kosmorro 0.10.1\n" "Project-Id-Version: kosmorro 0.10.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-06-20 16:49+0200\n"
"POT-Creation-Date: 2021-07-18 17:45+0200\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"
@@ -116,110 +116,113 @@ msgstr ""
msgid "The date must be between {minimum_date} and {maximum_date}" msgid "The date must be between {minimum_date} and {maximum_date}"
msgstr "" msgstr ""


#: _kosmorro/main.py:46
#: _kosmorro/geolocation.py:14
#, python-format
msgid "The given position (%s) is not valid."
msgstr ""

#: _kosmorro/geolocation.py:29
msgid "The given Plus Code seems to be a short code, please provide a full code."
msgstr ""

#: _kosmorro/main.py:42
msgid "" msgid ""
"Save the planet and paper!\n" "Save the planet and paper!\n"
"Consider printing your PDF document only if really necessary, and use the" "Consider printing your PDF document only if really necessary, and use the"
" other side of the sheet." " other side of the sheet."
msgstr "" msgstr ""


#: _kosmorro/main.py:55
#: _kosmorro/main.py:51
msgid "" msgid ""
"PDF output will not contain the ephemerides, because you didn't provide " "PDF output will not contain the ephemerides, because you didn't provide "
"the observation coordinates." "the observation coordinates."
msgstr "" msgstr ""


#: _kosmorro/main.py:100
#: _kosmorro/main.py:96
msgid "The file could not be saved in \"{path}\": {error}" msgid "The file could not be saved in \"{path}\": {error}"
msgstr "" msgstr ""


#: _kosmorro/main.py:114
#: _kosmorro/main.py:110
msgid "Please provide a file path to export in this format (--output)." msgid "Please provide a file path to export in this format (--output)."
msgstr "" msgstr ""


#: _kosmorro/main.py:147
#: _kosmorro/main.py:143
msgid "Moon phase can only be displayed between {min_date} and {max_date}" msgid "Moon phase can only be displayed between {min_date} and {max_date}"
msgstr "" msgstr ""


#: _kosmorro/main.py:186
#: _kosmorro/main.py:182
msgid "Running on Python {python_version} with Kosmorrolib v{kosmorrolib_version}" msgid "Running on Python {python_version} with Kosmorrolib v{kosmorrolib_version}"
msgstr "" msgstr ""


#: _kosmorro/main.py:196
#: _kosmorro/main.py:192
msgid "Do you really want to clear Kosmorro's cache? [yN] " msgid "Do you really want to clear Kosmorro's cache? [yN] "
msgstr "" msgstr ""


#: _kosmorro/main.py:204
#: _kosmorro/main.py:200
msgid "Incorrect answer, cache not cleared." msgid "Incorrect answer, cache not cleared."
msgstr "" msgstr ""


#: _kosmorro/main.py:214
#: _kosmorro/main.py:210
msgid "" msgid ""
"Compute the ephemerides and the events for a given date and a given " "Compute the ephemerides and the events for a given date and a given "
"position on Earth." "position on Earth."
msgstr "" msgstr ""


#: _kosmorro/main.py:217
#: _kosmorro/main.py:213
msgid "" msgid ""
"By default, only the events will be computed for today ({date}).\n" "By default, only the events will be computed for today ({date}).\n"
"To compute also the ephemerides, latitude and longitude arguments are " "To compute also the ephemerides, latitude and longitude arguments are "
"needed." "needed."
msgstr "" msgstr ""


#: _kosmorro/main.py:231
#: _kosmorro/main.py:227
msgid "Show the program version" msgid "Show the program version"
msgstr "" msgstr ""


#: _kosmorro/main.py:239
#: _kosmorro/main.py:235
msgid "Delete all the files from Kosmorro's cache." msgid "Delete all the files from Kosmorro's cache."
msgstr "" msgstr ""


#: _kosmorro/main.py:247
#: _kosmorro/main.py:243
msgid "The format to output the information to" msgid "The format to output the information to"
msgstr "" msgstr ""


#: _kosmorro/main.py:254
msgid ""
"The observer's latitude on Earth. Can also be set in the "
"KOSMORRO_LATITUDE environment variable."
msgstr ""

#: _kosmorro/main.py:264
#: _kosmorro/main.py:250
msgid "" msgid ""
"The observer's longitude on Earth. Can also be set in the "
"KOSMORRO_LONGITUDE 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:274
#: _kosmorro/main.py:260
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 today ({default_date})." " and D numbers). Defaults to today ({default_date})."
msgstr "" msgstr ""


#: _kosmorro/main.py:285
#: _kosmorro/main.py:271
msgid "" msgid ""
"The timezone to display the hours in (e.g. 2 for UTC+2 or -3 for UTC-3). " "The timezone to display the hours in (e.g. 2 for UTC+2 or -3 for UTC-3). "
"Can also be set in the KOSMORRO_TIMEZONE environment variable." "Can also be set in the KOSMORRO_TIMEZONE environment variable."
msgstr "" msgstr ""


#: _kosmorro/main.py:294
#: _kosmorro/main.py:280
msgid "Disable the colors in the console." msgid "Disable the colors in the console."
msgstr "" msgstr ""


#: _kosmorro/main.py:301
#: _kosmorro/main.py:287
msgid "" msgid ""
"A file to export the output to. If not given, the standard output is " "A file to export the output to. If not given, the standard output is "
"used. This argument is needed for PDF format." "used. This argument is needed for PDF format."
msgstr "" msgstr ""


#: _kosmorro/main.py:310
#: _kosmorro/main.py:296
msgid "" msgid ""
"Do not generate a graph to represent the rise and set times in the PDF " "Do not generate a graph to represent the rise and set times in the PDF "
"format." "format."
msgstr "" msgstr ""


#: _kosmorro/main.py:318
#: _kosmorro/main.py:304
msgid "Show debugging messages" msgid "Show debugging messages"
msgstr "" msgstr ""




+ 2
- 2
_kosmorro/main.py View File

@@ -35,7 +35,7 @@ def main():
print(colored(error.args[0], color="red", attrs=["bold"])) print(colored(error.args[0], color="red", attrs=["bold"]))
return -1 return -1


position = get_position(args.position) if args.position is not None else None
position = get_position(args.position) if args.position not in [None, ""] else None


if output_format == "pdf": if output_format == "pdf":
print( print(
@@ -248,7 +248,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."
), ),
) )


+ 4
- 10
manpage/kosmorro.1.md View File

@@ -16,11 +16,8 @@
`--clear-cache` `--clear-cache`
delete all the files Kosmorro stored in the cache delete all the files Kosmorro stored in the cache


`--latitude=`_LATITUDE_, `-lat` _LATITUDE_
the observer's latitude on Earth

`--longitude=`_LONGITUDE_, `-lon` _LONGITUDE_
the observer's longitude on Earth
`--position=`"_LATITUDE_,_LONGITUDE_", `-p` "_LATITUDE_,_LONGITUDE"
the observer's position on Earth


`--date=`_DATE_, `-d` _DATE_ `--date=`_DATE_, `-d` _DATE_
The date for which the ephemerides must be computed, either in the YYYY-MM-DD format or as an interval in the "[+-]YyMmDd" format (with Y, M, and D numbers); defaults to the current date The date for which the ephemerides must be computed, either in the YYYY-MM-DD format or as an interval in the "[+-]YyMmDd" format (with Y, M, and D numbers); defaults to the current date
@@ -48,11 +45,8 @@ As a consequence, any option that would be given to `kosmorro` will override its


Available environment variables are: Available environment variables are:


`KOSMORRO_LATITUDE`
the observer's latitude on Earth (alternative to `--latitude`)
`KOSMORRO_LONGITUDE`
the observer's longitude on Earth (alternative to `--longitude`)
`KOSMORRO_POSITION`
the observer's position on Earth (alternative to `--position`)
`KOSMORRO_TIMEZONE` `KOSMORRO_TIMEZONE`
the observer's timezone (alternative to `--timezone`) the observer's timezone (alternative to `--timezone`)


+ 1
- 0
setup.py View File

@@ -31,6 +31,7 @@ setup(
"tabulate", "tabulate",
"termcolor", "termcolor",
"python-dateutil", "python-dateutil",
"openlocationcode",
], ],
classifiers=[ classifiers=[
"Development Status :: 3 - Alpha", "Development Status :: 3 - Alpha",


Loading…
Cancel
Save