diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-30 19:08:56 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-30 19:11:19 +0100 |
| commit | 86555126d855df005bb1777c1c4ab7127c677b6c (patch) | |
| tree | 5afca23f0ab7a6bf091dc25fc4998d0c51347147 /tools/kman.py | |
| parent | 8d853a3235d37b746508d178b6128380b07ceb57 (diff) | |
feat: SMP support tweaks, add MACROS_MAP.md
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'tools/kman.py')
| -rwxr-xr-x | tools/kman.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/kman.py b/tools/kman.py new file mode 100755 index 00000000..366cd732 --- /dev/null +++ b/tools/kman.py @@ -0,0 +1,40 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- + +import sys, os + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("INFO: mk_htman.py <manual_path>") + sys.exit(os.EX_CONFIG) + + manual_path = sys.argv[1] + if not os.path.exists(manual_path): + print(f"ERROR: Manual path '{manual_path}' does not exist.") + sys.exit(os.EX_NOINPUT) + + if os.path.isdir(manual_path): + print(f"ERROR: Manual path '{manual_path}' is a directory.") + sys.exit(os.EX_NOTDIR) + + if not manual_path.endswith('.man'): + print(f"ERROR: Manual path '{manual_path}' must end with '.man'") + sys.exit(os.EX_DATAERR) + + try: + with open(manual_path, 'r') as file: + content = file.read() + if not content.strip(): + print(f"ERROR: Manual file '{manual_path}' is empty.") + sys.exit(os.EX_DATAERR) + html_content = f"<html><head><title>NeKernel Manual: {manual_path}</title></head><body><pre>{content}</pre></body></html>" + html_path = manual_path.replace('.man', '.html') + + with open(html_path, 'w') as html_file: + html_file.write(html_content) + except IOError as e: + print(f"ERROR: Could not read manual file '{manual_path}': {e}") + sys.exit(os.EX_IOERR) + + print(f"INFO: Wrote manual '{manual_path}' to HTML.") + sys.exit(os.EX_OK) |
