mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
dev/list-plugins: add markdown formatting
This commit is contained in:
parent
3726dbed68
commit
64681ae84c
1 changed files with 20 additions and 4 deletions
|
@ -160,6 +160,9 @@ class Plugin:
|
||||||
f"| {kind_icon}\033[0m | {state_icon} | {deprecation_icon} | {self.path}"
|
f"| {kind_icon}\033[0m | {state_icon} | {deprecation_icon} | {self.path}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def print_markdown(self) -> None:
|
||||||
|
print(f"- [ ] {self.path} ({self.kind.name.lower()})")
|
||||||
|
|
||||||
|
|
||||||
def has_deprecation_warnings(string: str) -> bool:
|
def has_deprecation_warnings(string: str) -> bool:
|
||||||
for regex in DEPRECATION_REGEX:
|
for regex in DEPRECATION_REGEX:
|
||||||
|
@ -218,13 +221,17 @@ def _is_excluded(path: str) -> bool:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args) -> None:
|
||||||
paths: list[str] = glob.glob(pathname="plugins/**/*.nix", recursive=True)
|
paths: list[str] = glob.glob(pathname="plugins/**/*.nix", recursive=True)
|
||||||
filtered_paths: list[str] = list(filter(_is_excluded, paths))
|
filtered_paths: list[str] = list(filter(_is_excluded, paths))
|
||||||
filtered_paths.sort()
|
filtered_paths.sort()
|
||||||
|
|
||||||
|
if not args.markdown:
|
||||||
print("| Typ | Sty | DW | path")
|
print("| Typ | Sty | DW | path")
|
||||||
print("|-----|-----|----|--------------------------------------------------------")
|
print(
|
||||||
|
"|-----|-----|----|--------------------------------------------------------"
|
||||||
|
)
|
||||||
|
|
||||||
for plugin_path in filtered_paths:
|
for plugin_path in filtered_paths:
|
||||||
plugin: Optional[Plugin] = parse_file(path=plugin_path)
|
plugin: Optional[Plugin] = parse_file(path=plugin_path)
|
||||||
if plugin is not None:
|
if plugin is not None:
|
||||||
|
@ -233,6 +240,9 @@ def main(args):
|
||||||
and (args.state is None or plugin.state.name.lower() == args.state)
|
and (args.state is None or plugin.state.name.lower() == args.state)
|
||||||
and (not args.deprecation_warnings or plugin.dep_warnings)
|
and (not args.deprecation_warnings or plugin.dep_warnings)
|
||||||
):
|
):
|
||||||
|
if args.markdown:
|
||||||
|
plugin.print_markdown()
|
||||||
|
else:
|
||||||
print(plugin)
|
print(plugin)
|
||||||
|
|
||||||
|
|
||||||
|
@ -265,5 +275,11 @@ if __name__ == "__main__":
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Show only plugins with deprecation warnings",
|
help="Show only plugins with deprecation warnings",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-m",
|
||||||
|
"--markdown",
|
||||||
|
action="store_true",
|
||||||
|
help="Markdown output",
|
||||||
|
)
|
||||||
|
|
||||||
main(parser.parse_args())
|
main(parser.parse_args())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue