mirror of
https://codeberg.org/forgejo/docs.git
synced 2025-05-07 19:25:55 +03:00
generate CLI docs from forgejo docs
with a perl script
(cherry picked from commit 5d167821dc
)
This commit is contained in:
parent
3e99c006af
commit
1ef10f350d
2 changed files with 2265 additions and 554 deletions
File diff suppressed because it is too large
Load diff
38
scripts/cli-docs.pl
Normal file
38
scripts/cli-docs.pl
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
# Add the frontmatter and a note at the top of the file
|
||||||
|
print <<EOM;
|
||||||
|
---
|
||||||
|
title: Forgejo CLI
|
||||||
|
license: 'CC-BY-SA-4.0'
|
||||||
|
---
|
||||||
|
<!--
|
||||||
|
This page should not be edited manually.
|
||||||
|
To update this page, run the following command from the root of the docs repo:
|
||||||
|
```
|
||||||
|
forgejo docs | perl ./scripts/cli-docs.pl > ./docs/admin/command-line.md
|
||||||
|
```
|
||||||
|
-->
|
||||||
|
|
||||||
|
_**Note**: this documentation is generated from the output of the Forgejo CLI command `forgejo docs`._
|
||||||
|
|
||||||
|
EOM
|
||||||
|
|
||||||
|
while (<>) {
|
||||||
|
# Replace 'Gitea' with 'Forgejo'
|
||||||
|
s/Gitea/Forgejo/g;
|
||||||
|
|
||||||
|
# Change bold formatting to code formatting for CLI parameters at the start of the line
|
||||||
|
s/^\*\*(\-\-[^*]+)\*\*(="")?/`$1`/g;
|
||||||
|
|
||||||
|
# Clean up the display of default values
|
||||||
|
s/\(default(s to|:) '?([^' )]+)'?\)/_(default: `$2`)_/g;
|
||||||
|
|
||||||
|
# Increase the level of all markdown headings
|
||||||
|
s/^#/##/;
|
||||||
|
|
||||||
|
print;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue