Skip to content

Commit 4abc908

Browse files
author
tgallone
committed
📝 Add documentation & text for sections
1 parent fa25993 commit 4abc908

File tree

2 files changed

+164
-121
lines changed

2 files changed

+164
-121
lines changed

scripts/gen-man.py

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
#!/usr/bin/env python3
2+
"""
3+
Python script to generate a man page for the command `fastfetch`.
4+
The man content will be printed to stdout so you will need to
5+
pipe it to a file if you want to save it.
6+
The command options will be generated using a JSON file.
7+
For the format of the JSON file, see https://github.com/fastfetch-cli/fastfetch/blob/dev/src/data/help.json
8+
"""
9+
210
from json import load
311
from datetime import date
412

5-
613
###### Parameters ######
714

8-
# path to the help.json file
15+
# path to the JSON option file
916
pathToHelpFile = "../src/data/help.json"
1017
# man page section
1118
manSection = 1
@@ -18,15 +25,34 @@
1825

1926

2027
# text displayed in the "NAME" section
21-
nameSection = "fastfetch - a neofetch-like tool for fetching system \
28+
nameSection = "\
29+
fastfetch - a neofetch-like tool for fetching system \
2230
information and displaying them in a pretty way"
2331

2432
# text displayed in the "DESCRIPTION" section
25-
descriptionSection = "A maintained, feature-rich and performance \
33+
descriptionSection = "\
34+
A maintained, feature-rich and performance \
2635
oriented, neofetch like system information tool."
2736

37+
# text displayed at the beginning of the "OPTIONS" section
38+
optionSection = "\
39+
Parsing is not case sensitive. E.g. \\fB--lib-PCI\\fR \
40+
is equal to \\fB--Lib-Pci\\fR. \
41+
\n\n\
42+
If a value is between square brakets, it is optional. \
43+
An optional boolean value defaults to true if not \
44+
specified. \
45+
\n\n\
46+
More detailed help messages for each options can be \
47+
printed with \\fB-h <option_without_dash_prefix>\\fR. \
48+
\n\n\
49+
All options can be made permanent with command \
50+
\\fBfastfetch <options> --gen-config\\fR. \
51+
"
52+
2853
# text displayed in the "BUGS" section
29-
bugSection = "Please report bugs to : https://github.com/fastfetch-cli/fastfetch/issues"
54+
bugSection = "Please report bugs to : \
55+
https://github.com/fastfetch-cli/fastfetch/issues"
3056

3157

3258
###### Text Decorations Tags ######
@@ -45,14 +71,16 @@
4571

4672
### optional arguments tags ###
4773

48-
# if an optional argument is displayed as [?optArg] (with "optArg" underlined), this value should be f"[?{startUnderline}"
74+
# if an optional argument is displayed as [?optArg] (with "optArg" underlined)
75+
# this value should be f"[?{startUnderline}"
4976
startOptionalArgument = f"[{startItalic}?"
50-
# if an optional argument is displayed as [?optArg] (with "optArg underlined"), this value should be f"{endUnderline}]"
77+
# if an optional argument is displayed as [?optArg] (with "optArg underlined")
78+
# this value should be f"{endUnderline}]"
5179
endOptionalArgument = f"{endItalic}]"
5280

53-
# mandatory arguments tags
54-
startMandatoryArgument = ""
55-
endMandatoryArgument = ""
81+
### mandatory arguments tags ###
82+
startMandatoryArgument = f"{startUnderline}"
83+
endMandatoryArgument = f"{endUnderline}"
5684

5785
def generateManPage():
5886

@@ -98,6 +126,8 @@ def generateManPage():
98126
###### Options ######
99127

100128
print(".SH OPTIONS")
129+
print(optionSection)
130+
print()
101131

102132
# loop through every options sections
103133
for key, value in helpFileData.items():
@@ -140,7 +170,10 @@ def generateManPage():
140170
# description
141171
print(f"\n {option['desc']} \n")
142172

173+
###### Bugs ######
143174

175+
print(".SH BUGS")
176+
print(bugSection)
144177

145178

146179

0 commit comments

Comments
 (0)