Explorar el Código

feat: add argument to get the current version

tags/v0.2.2
Jérôme Deuchnord hace 7 años
padre
commit
5f74b08d15
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: 6D1B91F131F89577
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  1. +11
    -0
      kosmorro

+ 11
- 0
kosmorro Ver fichero

@@ -20,6 +20,7 @@ import argparse
import sys import sys
from datetime import date from datetime import date


from kosmorrolib.version import VERSION
from kosmorrolib import dumper from kosmorrolib import dumper
from kosmorrolib import core from kosmorrolib import core
from kosmorrolib.ephemerides import EphemeridesComputer, Position from kosmorrolib.ephemerides import EphemeridesComputer, Position
@@ -55,6 +56,14 @@ def get_dumpers() -> {str: dumper.Dumper}:
} }




def output_version() -> bool:
python_version = '%d.%d.%d' % (sys.version_info[0], sys.version_info[1], sys.version_info[2])
print('Kosmorro %s' % VERSION)
print('Running on Python %s' % python_version)

return True


def clear_cache() -> bool: def clear_cache() -> bool:
confirm = input("Do you really want to clear Kosmorro's cache? [yN] ").upper() confirm = input("Do you really want to clear Kosmorro's cache? [yN] ").upper()
if confirm == 'Y': if confirm == 'Y':
@@ -78,6 +87,8 @@ def get_args(output_formats: [str]):
' observer positioned at coordinates (0,0), with an altitude of 0.' ' observer positioned at coordinates (0,0), with an altitude of 0.'
% today.strftime('%a %b %d, %Y')) % today.strftime('%a %b %d, %Y'))


parser.add_argument('--version', '-v', dest='special_action', action='store_const', const=output_version,
default=None, help='Show the program version')
parser.add_argument('--clear-cache', dest='special_action', action='store_const', const=clear_cache, default=None, parser.add_argument('--clear-cache', dest='special_action', action='store_const', const=clear_cache, default=None,
help='Delete all the files Kosmorro stored in the cache.') help='Delete all the files Kosmorro stored in the cache.')
parser.add_argument('--format', '-f', type=str, default=output_formats[0], choices=output_formats, parser.add_argument('--format', '-f', type=str, default=output_formats[0], choices=output_formats,


Cargando…
Cancelar
Guardar