瀏覽代碼

feat: check environment variable for output color

update man pages

fix formatting

update man pages

add NO_COLOR constant

minor changes for PR

add missing import

update messages
pull/227/head
nicfb 2 年之前
committed by Jérôme Deuchnord
父節點
當前提交
496307eb5c
共有 4 個檔案被更改,包括 44 行新增27 行删除
  1. +1
    -0
      _kosmorro/environment.py
  2. +37
    -26
      _kosmorro/locales/messages.pot
  3. +3
    -1
      _kosmorro/main.py
  4. +3
    -0
      manpage/kosmorro.1.md

+ 1
- 0
_kosmorro/environment.py 查看文件

@@ -21,6 +21,7 @@ import re
from pathlib import Path

CACHE_FOLDER = str(Path.home()) + "/.kosmorro-cache"
NO_COLOR = "NO_COLOR" in os.environ


class Environment:


+ 37
- 26
_kosmorro/locales/messages.pot 查看文件

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: kosmorro 0.10.7\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-12-04 11:58+0100\n"
"POT-Creation-Date: 2021-12-04 22:15-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -116,98 +116,109 @@ msgstr ""
msgid "The date must be between {minimum_date} and {maximum_date}"
msgstr ""

#: _kosmorro/main.py:62
#: _kosmorro/exceptions.py:47
msgid ""
"Invalid output format: {output_format}. Output file must end with: "
"{accepted_extensions}"
msgstr ""

#: _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:73
msgid ""
"Save the planet and paper!\n"
"Consider printing your PDF document only if really necessary, and use the"
" other side of the sheet."
msgstr ""

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

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

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

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

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

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

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

#: _kosmorro/main.py:232
#: _kosmorro/main.py:260
msgid "Show the program version"
msgstr ""

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

#: _kosmorro/main.py:247
#: _kosmorro/main.py:268
msgid ""
"The observer's latitude on Earth. Can also be set in the "
"KOSMORRO_LATITUDE environment variable."
"The format to output the information to. If not provided, the output "
"format will be inferred from the file extension of the output file."
msgstr ""

#: _kosmorro/main.py:257
#: _kosmorro/main.py:278
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 ""

#: _kosmorro/main.py:267
#: _kosmorro/main.py:288
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 today ({default_date})."
msgstr ""

#: _kosmorro/main.py:278
#: _kosmorro/main.py:299
msgid ""
"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."
msgstr ""

#: _kosmorro/main.py:287
#: _kosmorro/main.py:308
msgid "Disable the colors in the console."
msgstr ""

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

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

#: _kosmorro/main.py:311
#: _kosmorro/main.py:332
msgid "Show debugging messages"
msgstr ""



+ 3
- 1
_kosmorro/main.py 查看文件

@@ -95,12 +95,14 @@ def main():
timezone = 0

try:
use_colors = not environment.NO_COLOR and args.colors

output = get_information(
compute_date,
position,
timezone,
output_format,
args.colors,
use_colors,
args.show_graph,
)
except InvalidOutputFormatError as error:


+ 3
- 0
manpage/kosmorro.1.md 查看文件

@@ -51,6 +51,9 @@ Available environment variables are:
`KOSMORRO_TIMEZONE`
the observer's timezone (alternative to `--timezone`)

`NO_COLOR`
disable colored console output (alternative to `--no-colors`)

## EXAMPLES

Compute the events only for the current date:


Loading…
取消
儲存