mirror of
https://github.com/akuker/RASCSI.git
synced 2026-04-21 02:17:25 +00:00
Add capabilities to get and render manpage output in the Web UI (#881)
- class method to get arbitrary file contents - new web UI endpoint to fetch the contents of rascsi man pages (rendered txt files) - Link to manpage in page footer - Link to new wiki page for image type docs - Other UI tweaks
This commit is contained in:
@@ -181,3 +181,15 @@ class SysCmds:
|
||||
return process.returncode, process.stdout.decode("utf-8")
|
||||
|
||||
return process.returncode, process.stderr.decode("utf-8")
|
||||
|
||||
@staticmethod
|
||||
def get_filecontents(file_path):
|
||||
"""
|
||||
Takes (str) file_path, with the path to the file to fetch the contents of.
|
||||
Returns either the file contents, or the exception error.
|
||||
"""
|
||||
try:
|
||||
with open(file_path) as file:
|
||||
return 0, file.read()
|
||||
except Exception as error:
|
||||
return 1, error
|
||||
|
||||
Reference in New Issue
Block a user