forked from clan/clan-core
WIP manpage
This commit is contained in:
parent
132066b319
commit
165c04f4bf
0
pkgs/clan-cli/clan.1
Normal file
0
pkgs/clan-cli/clan.1
Normal file
@ -285,7 +285,7 @@ def collect_commands() -> list[Category]:
|
|||||||
|
|
||||||
|
|
||||||
class ManPage:
|
class ManPage:
|
||||||
def __init__(self, name: str, section: int):
|
def __init__(self, name: str, section: int) -> None:
|
||||||
self.name = name
|
self.name = name
|
||||||
self.section = section
|
self.section = section
|
||||||
|
|
||||||
@ -295,18 +295,101 @@ class ManPage:
|
|||||||
# def add_option(self, option, description):
|
# def add_option(self, option, description):
|
||||||
# self.options[option] = description
|
# self.options[option] = description
|
||||||
|
|
||||||
def control(self, control: str, content: str) -> None:
|
def control(self, control: str, content: str | None = None) -> None:
|
||||||
self.manpage = self.manpage + f".{control} {content}"
|
if content:
|
||||||
|
self.manpage = self.manpage + f".{control} {content}"
|
||||||
|
else:
|
||||||
|
self.manpage = self.manpage + f".{control}"
|
||||||
self.manpage = self.manpage + "\n"
|
self.manpage = self.manpage + "\n"
|
||||||
|
|
||||||
|
def line(self, content: str | None = None) -> None:
|
||||||
|
self.manpage = self.manpage + f"{content}"
|
||||||
|
self.manpage = self.manpage + "\n"
|
||||||
|
|
||||||
|
def newline(self) -> None:
|
||||||
|
self.manpage = self.manpage + "\n"
|
||||||
|
|
||||||
|
def paragraph(self) -> None:
|
||||||
|
self.newline()
|
||||||
|
self.control("PP")
|
||||||
|
|
||||||
|
def contribute(self) -> None:
|
||||||
|
"""
|
||||||
|
Contributing section of the manpages
|
||||||
|
should only be shown on the root page.
|
||||||
|
"""
|
||||||
|
self.control("SH", "CONTRIBUTE")
|
||||||
|
self.control(
|
||||||
|
"PP",
|
||||||
|
)
|
||||||
|
self.line("Bug reports, contributions and forks are welcome.")
|
||||||
|
self.newline()
|
||||||
|
self.control(
|
||||||
|
"PP",
|
||||||
|
)
|
||||||
|
self.line(
|
||||||
|
"The code lives on gitea, you can use the issue tracker to file bugs, or issues and give feedback."
|
||||||
|
)
|
||||||
|
self.newline()
|
||||||
|
self.line(self.link("https://git.clan.lol/clan/clan-core"))
|
||||||
|
|
||||||
|
self.paragraph()
|
||||||
|
self.line(
|
||||||
|
"There is a matrix channel available where you can give feedback, or get feedback."
|
||||||
|
)
|
||||||
|
self.line("Share your usage patterns or share tips and tricks.")
|
||||||
|
self.newline()
|
||||||
|
self.line(self.link("https://matrix.to/#/#clan:lassul.us"))
|
||||||
|
|
||||||
|
def link(self, link: str) -> str:
|
||||||
|
"""
|
||||||
|
Format a link
|
||||||
|
"""
|
||||||
|
return "\[la]" + link + "\[ra]"
|
||||||
|
|
||||||
def render(self) -> str:
|
def render(self) -> str:
|
||||||
self.manpage = ""
|
self.manpage = ""
|
||||||
self.control("TH", "Clan 1")
|
self.control("nh")
|
||||||
|
self.control("TH", 'CLAN 1 2023 clan "User Manuals"')
|
||||||
self.control("SH", "NAME")
|
self.control("SH", "NAME")
|
||||||
|
self.control(
|
||||||
|
"PP",
|
||||||
|
)
|
||||||
|
# overview
|
||||||
|
self.line("clan - the clan cli tool")
|
||||||
|
self.newline()
|
||||||
|
|
||||||
|
# synopsis
|
||||||
|
self.control("SH", "SYNOPSIS")
|
||||||
|
self.control(
|
||||||
|
"PP",
|
||||||
|
)
|
||||||
|
self.line("clan [OPTIONS] [SUBCOMMAND]")
|
||||||
|
self.newline()
|
||||||
|
|
||||||
|
# description
|
||||||
|
self.control("SH", "DESCRIPTION")
|
||||||
|
self.control(
|
||||||
|
"PP",
|
||||||
|
)
|
||||||
|
self.line("clan is a distributed systems manager for your fingertips.")
|
||||||
|
self.line("It knows how to update your machines.")
|
||||||
|
self.line(
|
||||||
|
"It knows how to generate and manage secrets and facts for your services."
|
||||||
|
)
|
||||||
|
self.line(
|
||||||
|
"It knows which services have state in which directories and can manage backups for machines and services."
|
||||||
|
)
|
||||||
|
self.paragraph()
|
||||||
|
|
||||||
# manpage = f"NAME\n\t{self.name} - {self.description}\n\nDESCRIPTION\n\t{self.description}\n\nOPTIONS\n"
|
# manpage = f"NAME\n\t{self.name} - {self.description}\n\nDESCRIPTION\n\t{self.description}\n\nOPTIONS\n"
|
||||||
|
|
||||||
|
# for options in self.options.items():
|
||||||
|
# print(options)
|
||||||
|
|
||||||
# for option, desc in self.options.items():
|
# for option, desc in self.options.items():
|
||||||
# manpage += f"\t-{option}\n\t\t{desc}\n"
|
# manpage += f"\t-{option}\n\t\t{desc}\n"
|
||||||
|
self.contribute()
|
||||||
|
|
||||||
return self.manpage
|
return self.manpage
|
||||||
|
|
||||||
@ -323,6 +406,12 @@ def build_manpage() -> None:
|
|||||||
|
|
||||||
print(man.render())
|
print(man.render())
|
||||||
|
|
||||||
|
for command in cmds:
|
||||||
|
if command.title == "facts":
|
||||||
|
print(command)
|
||||||
|
|
||||||
|
# TODO: gather all level one subcommands
|
||||||
|
|
||||||
# folder = Path("out")
|
# folder = Path("out")
|
||||||
# folder.mkdir(parents=True, exist_ok=True)
|
# folder.mkdir(parents=True, exist_ok=True)
|
||||||
pass
|
pass
|
||||||
|
213
templates/new-clan/flake.lock
Normal file
213
templates/new-clan/flake.lock
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"clan-core": {
|
||||||
|
"inputs": {
|
||||||
|
"disko": "disko",
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"nixos-generators": "nixos-generators",
|
||||||
|
"nixos-images": "nixos-images",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"sops-nix": "sops-nix",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716971153,
|
||||||
|
"narHash": "sha256-3QXK2SJRLMBOB1urY64WpXPKIWcq1LilBO8xeD6cBZg=",
|
||||||
|
"ref": "refs/heads/main",
|
||||||
|
"rev": "d138e29a53678c94c600a4aeb125c2ece0267271",
|
||||||
|
"revCount": 2911,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.clan.lol/clan/clan-core"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.clan.lol/clan/clan-core"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"disko": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"clan-core",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716394172,
|
||||||
|
"narHash": "sha256-B+pNhV8GFeCj9/MoH+qtGqKbgv6fU4hGaw2+NoYYtB0=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"rev": "23c63fb09334c3e8958b57e2ddc3870b75b9111d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": [
|
||||||
|
"clan-core",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715865404,
|
||||||
|
"narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixlib": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1712450863,
|
||||||
|
"narHash": "sha256-K6IkdtMtq9xktmYPj0uaYc8NsIqHuaAoRBaMgu9Fvrw=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"rev": "3c62b6a12571c9a7f65ab037173ee153d539905f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixos-2311": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715818734,
|
||||||
|
"narHash": "sha256-WvAJWCwPj/6quKcsgsvQYyZRxV8ho/yUzj0HZQ34DVU=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "95742536dc6debb5a8b8b78b27001c38f369f1e7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "release-23.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixos-generators": {
|
||||||
|
"inputs": {
|
||||||
|
"nixlib": "nixlib",
|
||||||
|
"nixpkgs": [
|
||||||
|
"clan-core",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716123454,
|
||||||
|
"narHash": "sha256-U2o4UPM/UsEyIX2p11+YEQgR9HY3PmjZ2mRl/x5e4xo=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixos-generators",
|
||||||
|
"rev": "a63e0c83dd83fe28cc571b97129e13373436bd82",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixos-generators",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixos-images": {
|
||||||
|
"inputs": {
|
||||||
|
"nixos-2311": "nixos-2311",
|
||||||
|
"nixos-unstable": [
|
||||||
|
"clan-core",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716132123,
|
||||||
|
"narHash": "sha256-rATSWbPaKQfZGaemu0tHL2xfCzVIVwpuTjk+KSBC+k4=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixos-images",
|
||||||
|
"rev": "8c9cab8c44434c12dafc465fbf61a710c5bceb08",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixos-images",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716127062,
|
||||||
|
"narHash": "sha256-2rk8FqB/iQV2d0vQLs684/Tj5PUHaS1sFwG7fng5vXE=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "8a2555763c48e2410054de3f52f7310ce3241ec5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable-small",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"clan-core": "clan-core"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sops-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"clan-core",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs-stable": [
|
||||||
|
"clan-core"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716087663,
|
||||||
|
"narHash": "sha256-zuSAGlx8Qk0OILGCC2GUyZ58/SJ5R3GZdeUNQ6IS0fQ=",
|
||||||
|
"owner": "Mic92",
|
||||||
|
"repo": "sops-nix",
|
||||||
|
"rev": "0bf1808e70ce80046b0cff821c019df2b19aabf5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Mic92",
|
||||||
|
"repo": "sops-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"treefmt-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"clan-core",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715940852,
|
||||||
|
"narHash": "sha256-wJqHMg/K6X3JGAE9YLM0LsuKrKb4XiBeVaoeMNlReZg=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "2fba33a182602b9d49f0b2440513e5ee091d838b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user