summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-07-23 09:21:11 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-07-23 09:21:11 +0100
commit9d1576313977b15b05421d646809ec1f2c413854 (patch)
treed09866601f1aca7e670a4b055b5a8307cbdcef76
parent6d16db11d91c5fdf302af54e8e797dcbed8c9c71 (diff)
feat: tooling: wrote a simple nekernel manual to html converter.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--public/manuals/nekernel/mgmt.util.man2
-rw-r--r--public/manuals/nekernel/mgmt.util.man.html85
-rwxr-xr-xtooling/mk_htman.py34
3 files changed, 34 insertions, 87 deletions
diff --git a/public/manuals/nekernel/mgmt.util.man b/public/manuals/nekernel/mgmt.util.man
index 1c46002b..7f1bbba3 100644
--- a/public/manuals/nekernel/mgmt.util.man
+++ b/public/manuals/nekernel/mgmt.util.man
@@ -29,4 +29,4 @@ EXAMPLES
Schedules `pgp-update.script` to run at 2:30PM on Wednesday, April 2026.
RELEASE
- System One — NeKernel \ No newline at end of file
+ v1.0.0 — NeKernel.org \ No newline at end of file
diff --git a/public/manuals/nekernel/mgmt.util.man.html b/public/manuals/nekernel/mgmt.util.man.html
deleted file mode 100644
index 6f1ddc13..00000000
--- a/public/manuals/nekernel/mgmt.util.man.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>mgmt Manual Page</title>
- <style>
- body {
- font-family: monospace;
- background-color: #f4f4f4;
- padding: 2em;
- color: #222;
- }
-
- h1,
- h2 {
- border-bottom: 1px solid #aaa;
- }
-
- code {
- background: #eee;
- padding: 0.2em 0.4em;
- border-radius: 4px;
- }
-
- section {
- margin-bottom: 2em;
- }
- </style>
-</head>
-
-<body>
- <h1>mgmt</h1>
- <section>
- <h2>NAME</h2>
- <p><strong>mgmt</strong> &mdash; Management utility command</p>
- </section>
-
- <section>
- <h2>SYNOPSIS</h2>
- <p><code>mgmt [OPTIONS]</code></p>
- </section>
-
- <section>
- <h2>DESCRIPTION</h2>
- <p>
- The <code>mgmt</code> command provides scheduling, execution, and remote orchestration
- capabilities within the System One operating environment. It serves as the main task
- and maintenance utility for NeKernel deployments.
- </p>
- <ul>
- <li>Schedule scripts or tasks for future execution.</li>
- <li>Verify device or filesystem integrity.</li>
- <li>Manage and automate remote NeKernel machines.</li>
- </ul>
- </section>
-
- <section>
- <h2>OPTIONS</h2>
- <ul>
- <li><code>-s, --script &lt;FILE&gt;</code>: Script to execute</li>
- <li><code>-t, --time &lt;HH:MMAM/PM&gt;</code>: Time to run the script</li>
- <li><code>-d, --day &lt;DAY&gt;</code>: Day of the week (e.g., Mon, Tue, Wed)</li>
- <li><code>-m, --month &lt;MONTH&gt;</code>: Month (e.g., Jan, Feb, Mar)</li>
- <li><code>-y, --year &lt;YYYY&gt;</code>: Year to schedule task</li>
- <li><code>-r, --remote &lt;ADDRESS&gt;</code>: Remote machine to manage (optional)</li>
- <li><code>-v, --verify</code>: Run integrity checks only</li>
- <li><code>-h, --help</code>: Display this help message</li>
- </ul>
- </section>
-
- <section>
- <h2>EXAMPLES</h2>
- <pre><code>mgmt -s pgp-update.script -t 2:30PM -d Wed -m Apr -y 2026</code></pre>
- <p>Schedules <code>pgp-update.script</code> to run at 2:30PM on Wednesday, April 2026.</p>
- </section>
-
- <section>
- <h2>RELEASE</h2>
- <p>System One &mdash; NeKernel</p>
- </section>
-</body>
-
-</html> \ No newline at end of file
diff --git a/tooling/mk_htman.py b/tooling/mk_htman.py
index 5488d478..e865f7c5 100755
--- a/tooling/mk_htman.py
+++ b/tooling/mk_htman.py
@@ -5,5 +5,37 @@ import sys, os
if __name__ == "__main__":
if len(sys.argv) != 2:
- print("INFO: manual.py <manual_path>")
+ 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)