diff --git a/README.md b/README.md index b35f602..0bc1358 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ pyinstaller --specpath "build" --distpath "build\dist" -p "." --clean -F -i NONE Feel free to fork this project for your own uses, any Pull Requests back to the original repository would be greatly appreciated! ## To-Do List -- [ ] Add `--version` command that displays version number (and maybe release date) +- [x] Add `--version` command that displays version number (and maybe release date) - [ ] Implement parsing of `igc` [tasks](https://xp-soaring.github.io/igc_file_format/igc_format_2008.html#link_3.6) and [events](https://xp-soaring.github.io/igc_file_format/igc_format_2008.html#link_4.2) into `acmi` [events](https://www.tacview.net/documentation/acmi/en/#Events) - [ ] Improve and augment error handling, i.e: for flights with missing/invalid date fields in their header - [ ] Add a way for the user to determine the output file's name or name template \ No newline at end of file diff --git a/combine-igcs/combine-igcs.py b/combine-igcs/combine-igcs.py index dc75d13..99e0636 100644 --- a/combine-igcs/combine-igcs.py +++ b/combine-igcs/combine-igcs.py @@ -108,6 +108,10 @@ def main(): # parse all arguments args = parser.parse_args() + if args.version: + print(a.version) + return + try: # define input path inPath = a.parseArgPath(args.input, "Input") diff --git a/common/args.py b/common/args.py index f61aba2..8ed3e54 100644 --- a/common/args.py +++ b/common/args.py @@ -1,8 +1,16 @@ import pathlib as pl from common import console as c +# current release version +version = "v0.2 - 2021.12.10" + # common arguments that every program uses def addDefaultArgs(parser): + parser.add_argument( + "--version", + action = "store_true", + help = 'print current version number+date' + ) parser.add_argument( "-r", "--remove", diff --git a/common/functions.py b/common/functions.py index 1e9175d..89d299a 100644 --- a/common/functions.py +++ b/common/functions.py @@ -1,6 +1,7 @@ import datetime as dt import zipfile as zf import pathlib as pl +from common import args as a # FILE NAME/PATH PARSING @@ -92,7 +93,7 @@ def getFlightHeader(filename): # takes a .igc filepath and returns header data a # ACMI FILE PARSING def acmiFileInit(refDateTime): # takes reference datetime object and returns the first 3 acmi lines - return "FileType=text/acmi/tacview\nFileVersion=2.1\n0,ReferenceTime="+refDateTime.strftime("%Y-%m-%d")+"T"+refDateTime.strftime("%H:%M:%S")+"Z\n" + return "FileType=text/acmi/tacview\nFileVersion=2.1\nDataRecorder=igc2acmi "+a.version+"\n0,ReferenceTime="+refDateTime.strftime("%Y-%m-%d")+"T"+refDateTime.strftime("%H:%M:%S")+"Z\n" def acmiObjInit(header, id=1000): # takes a parsed .igc header and returns the respective ACMI object init line return str(id)+",Name="+header["actype"]+",CallSign="+header["callsign"]+",Pilot="+header["pilot"]+"\n" diff --git a/convert-all-igcs/convert-all-igcs.py b/convert-all-igcs/convert-all-igcs.py index 51f0d62..48d5ada 100644 --- a/convert-all-igcs/convert-all-igcs.py +++ b/convert-all-igcs/convert-all-igcs.py @@ -20,6 +20,10 @@ def main(): # parse all arguments args = parser.parse_args() + if args.version: + print(a.version) + return + try: # define input path inPath = a.parseArgPath(args.input, "Input") diff --git a/igc2acmi/igc2acmi.py b/igc2acmi/igc2acmi.py index a26c71c..b717ffc 100644 --- a/igc2acmi/igc2acmi.py +++ b/igc2acmi/igc2acmi.py @@ -18,6 +18,10 @@ def main(): # parse all arguments args = parser.parse_args() + if args.version: + print(a.version) + return + try: # define input file path and name igcTuple = fnc.parsePathName(args.input_igc_file)