1111import os
1212import re
1313
14- MEADE_HPP = "..\\ src\\ MeadeCommandProcessor.cpp"
14+ MEADE_CPP = "..\\ src\\ MeadeCommandProcessor.cpp"
15+ VERSION_FILE = "..\\ Version.h"
1516MODULE_PATH = os .path .dirname (os .path .realpath (__file__ ))
1617START_LINE = 0
1718END_LINE = 0
@@ -122,8 +123,13 @@ def check_command_sepparator(line):
122123 else :
123124 return False
124125
125- # Meade hpp File
126- with open (os .path .join (MODULE_PATH , MEADE_HPP )) as f :
126+
127+ # ***************************************************************
128+ # PARSE MEADE COMMANDS
129+ # ***************************************************************
130+
131+ # Meade cpp File
132+ with open (os .path .join (MODULE_PATH , MEADE_CPP )) as f :
127133 content = f .readlines ()
128134content = [x .strip () for x in content ]
129135
@@ -226,6 +232,24 @@ def check_command_sepparator(line):
226232 new_family .commands .append (command )
227233 all_commands .append (new_family )
228234
235+ # ***************************************************************
236+ # PARSE MEADE COMMANDS
237+ # ***************************************************************
238+ CURRENT_VERSION = "0.0"
239+ with open (os .path .join (MODULE_PATH , VERSION_FILE )) as f :
240+ version_content = f .readlines ()
241+ version_content = [x .strip () for x in version_content ]
242+
243+ for line in version_content :
244+ if "#define VERSION" in line :
245+ CURRENT_VERSION = line .replace ("#define VERSION " , "" )
246+ CURRENT_VERSION = CURRENT_VERSION .replace ("\" " , "" )
247+ print (f"Found current version: { CURRENT_VERSION } " )
248+
249+ if CURRENT_VERSION == "0.0" :
250+ raise Exception ("Could not find current version to parse from" )
251+
252+
229253def output_wiki ():
230254 """
231255 Writes content to a MeadeToWikiOutput.txt file
@@ -236,6 +260,9 @@ def output_wiki():
236260 for fam in all_commands :
237261 f .write ("> AUTOMATICALLY GENERATED FROM FIRMWARE - DO NOT EDIT\n " )
238262 f .write ("{.is-danger}\n \n " )
263+
264+ f .write (f"> This documentation is current as of Firmware **{ CURRENT_VERSION } **\n " )
265+ f .write ("{.is-warning}\n \n " )
239266
240267 f .write (f"## { fam .name } \n " )
241268 f .write ("<br>\n \n " )
0 commit comments