Doc: update documents

This commit is contained in:
李通洲
2025-04-04 18:15:54 +08:00
parent 88eaab670f
commit 16c56254b0
8 changed files with 538 additions and 370 deletions
+13
View File
@@ -1,3 +1,16 @@
# 2.40.2
Changes:
* Since v2.40.0, we've been loading config files from the directory where the fastfetch binary is located. However, this approach may lead to loading unexpected files. For example, `fastfetch -c groups` would attempt to load `/usr/bin/groups`. Therefore, we now enforce the `.jsonc` extension when loading config files. Examples:
1. `-c filename`: loads `filename.jsonc`
2. `-c filename.jsonc`: loads `filename.jsonc`
3. `-c filename.json`: loads `filename.json` and enforces strict JSON syntax (no comments or trailing commas)
4. `-c filename.ext`: loads `filename.ext.jsonc` (`.jsonc` extension is enforced)
Features:
* Mark kitty image protocol support for warp terminal (Logo)
* Documentation improvements
# 2.40.1
Bugfixes:
+140 -59
View File
@@ -1,8 +1,7 @@
.TH FASTFETCH 1 "@FASTFETCH_BUILD_DATE@" "@CMAKE_PROJECT_NAME@ @CMAKE_PROJECT_VERSION@"
.SH NAME
fastfetch \- a neofetch\-like tool for fetching system information and
displaying them in a pretty way
fastfetch \- a fast and customizable system information tool similar to neofetch
.SH SYNOPSIS
@@ -11,15 +10,12 @@ displaying them in a pretty way
.SH DESCRIPTION
Fastfetch is a neofetch\-like tool for fetching system information and
displaying them in a pretty way. It is written mainly in C, with performance
and customizability in mind.
Currently, Linux, Android, FreeBSD, MacOS and Windows 7+ are supported.
Fastfetch is a tool for displaying system information in a visually appealing way. Written primarily in C, it focuses on performance and customizability while providing functionality similar to neofetch.
It supports Linux, Android, *BSD, macOS, Haiku, and Windows 7 or newer.
.SH "EXIT STATUS"
On successful execution, fastfetch returns zero. If any error happened,
the exit code will be non\-zero.
Fastfetch returns zero on successful execution. Any errors result in a non-zero exit code.
.SH OPTIONS
@@ -27,115 +23,200 @@ the exit code will be non\-zero.
.TP
.B \-h, \-\-help \fI[command]
Show help output, displaying all available options or help for given command
Display help information for all available options or for a specific command
.TP
.B \-v, \-\-version
Show version of fastfetch
Display the version of fastfetch
.TP
.B \-\-version\-raw
Display the raw version string (major.minor.patch)
.TP
.B \-\-list\-config\-paths
List search paths of config files
List search paths for configuration files
.TP
.B \-\-list\-data\-paths
List search paths of presets and logos
List search paths for presets and logos
.TP
.B \-\-list\-logos
List available logos, they can be loaded with \fI\-\-logo
List available logos that can be loaded with \fI\-\-logo
.TP
.B \-\-list\-modules
List available modules
List all available modules
.TP
.B \-\-list\-presets
List available presets, they can be loaded with \fI\-\-config
List available presets that can be loaded with \fI\-\-config
.TP
.B \-\-list\-features
List the supported features fastfetch was compiled with
List the features that fastfetch was compiled with (mainly for development)
.TP
.B \-\-print\-logos
Print available logos
Display all available logos
.TP
.B \-\-print\-structure
Print the default structure
Display the default structure
.TP
.B \-\-format \fI<type>
Set the output format. Besides the
.I default
format, only
.I json
is supported currently.
.SS "Display Options"
.TP
.B \-l, \-\-logo \fI<logo>
Set the logo to display
.TP
.B \-s, \-\-structure \fI<structure>
Set the structure of the fetch. For details about the structure,
see the CONFIGURATION section.
Set the output format. Available options are:
.RS
.IP \(bu 2
\fIdefault\fR: Standard human-readable format
.IP \(bu 2
\fIjson\fR: JSON format for machine processing
.RE
.SS "Config Options"
.TP
.B \-c, \-\-config \fI<config>
Use the specified config file or preset. If
.I none
is specified, disable further config loading. For details about
config files, see the CONFIGURATION section
Use the specified config file or preset. Specify \fInone\fR to disable further config loading. See the CONFIGURATION section for details on config files.
.TP
.B \-\-gen\-config \fI[file]
Generate a config file with options specified on the command line.
If \fIfile\fR is specified, the configuration will be written to the
file, otherwise it will be written to stdout.
.B \-\-gen\-config \fI[path]
Generate a config file with options specified on the command line. If \fIpath\fR is not specified, it defaults to \fB~/.config/fastfetch/config.jsonc\fR. If \fIpath\fR is "\-", the configuration will be written to stdout.
.TP
.B \-\-gen\-config\-force \fI[file]
Same as \fB\-\-gen\-config\fR, but overwrites existing config
.B \-\-gen\-config\-force \fI[path]
Same as \fB\-\-gen\-config\fR, but overwrites any existing file at the destination path.
.TP
.SS "Logo Options"
.TP
To list all options, use \fB\-\-help\fR. It will also print all available module options.
.B \-l, \-\-logo \fI<logo>
Set the logo to display. Can be the name of a built-in logo or a path to an image file. Use \fInone\fR to disable the logo.
.TP
.B \-\-logo\-type \fI<type>
Set the type of the logo specified with \fI\-\-logo\fR. Available types include \fIauto\fR, \fIbuiltin\fR, \fIfile\fR, \fIsixel\fR, \fIkitty\fR, and others. See \fB\-\-help logo\-type\fR for details.
.TP
.B \-\-logo\-width \fI<width>
Set the width of the logo in characters (for image logos)
.TP
.B \-\-logo\-height \fI<height>
Set the height of the logo in characters (for image logos)
.TP
.B \-\-logo\-color\-[1\-9] \fI<color>
Override specific colors in the logo
.SS "Display Options"
.TP
.B \-s, \-\-structure \fI<structure>
Set the structure of the fetch (a colon-separated list of module names)
.TP
.B \-\-color \fI<color>
Set the color of keys and title. See \fB\-\-help color\fR for available colors.
.TP
.B \-\-color\-keys \fI<color>
Set the color of keys only
.TP
.B \-\-color\-title \fI<color>
Set the color of the title only
.TP
.B \-\-separator \fI<string>
Set the separator between key and value (default: ": ")
.TP
.B \-\-key\-width \fI<num>
Align the width of keys to \fI<num>\fR characters
.TP
.B \-\-show\-errors
Display errors when they occur (default: false)
.TP
.B \-\-pipe
Disable colors (automatically detected based on whether stdout is a terminal)
To list all available options including module-specific options, use \fB\-\-help\fR.
.SH CONFIGURATION
.SS "Fetch Structure"
The structure of a fetch describes the modules that should be included in
the output. It consists of a string of modules, separated by a colon (:).
The structure defines which modules to display and in what order. It consists of module names separated by colons (:).
For example: \fBtitle:separator:os:kernel:uptime\fR
To list all available modules, use \fB\-\-list\-modules\fR
.SS "Config Files"
Fastfetch uses JSONC based format for configuration. Fastfetch doesn't generate
config file automatically; it should be generated manually by \fB\-\-gen\-config\fR.
The config file will be saved in \fB~/.config/fastfetch/config.jsonc\fR by default.
Fastfetch uses JSONC for configuration files. JSONC is JSON with support for comments (// and /* */). Configuration files must have the .jsonc extension.
A JSONC config file is a JSON file that also supports comments with (// and /* */).
Those files must have the extension '.jsonc'.
You can generate a default config file using \fB\-\-gen\-config\fR. By default, the config file is saved at \fB~/.config/fastfetch/config.jsonc\fR.
The specified configuration/preset files are searched in the following order:
The configuration/preset files are searched in the following locations (in order):
1. relative to the current working directory
.RS
.IP 1. 4
Relative to the current working directory
.IP 2. 4
Relative to ~/.local/share/fastfetch/presets/
.IP 3. 4
Relative to /usr/share/fastfetch/presets/
.RE
2. relative to ~/.local/share/fastfetch/presets/
For detailed information on logo options, module configuration, and formatting, visit:
.RS
\fIhttps://github.com/fastfetch-cli/fastfetch/wiki/Configuration\fR
.RE
3. relative to /usr/share/fastfetch/presets/
Fastfetch provides several built-in presets. List them with \fB\-\-list\-presets\fR.
Fastfetch provides some default presets. List them with \fB\-\-list\-presets\fR.
.SS "JSON Schema"
A JSON schema is available for editor intelligence when editing the configuration file. Add the following line at the beginning of your config file:
.PP
\fB"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json"\fR
.SH EXAMPLES
.TP
Basic usage:
.RS
\fBfastfetch\fR
.RE
.TP
Use a specific logo:
.RS
\fBfastfetch \-\-logo arch\fR
.RE
.TP
Custom structure:
.RS
\fBfastfetch \-\-structure title:os:kernel:uptime:memory\fR
.RE
.TP
Generate a config file:
.RS
\fBfastfetch \-\-gen\-config\fR
.RE
.TP
Use a preset:
.RS
\fBfastfetch \-\-config neofetch\fR
.RE
.SH "SEE ALSO"
.BR neofetch (1)
.SH BUGS
Please report bugs to: \fIhttps://github.com/fastfetch\-cli/fastfetch/issues\fR
.SH AUTHORS
Fastfetch is developed by a team of contributors on GitHub.
Visit \fIhttps://github.com/fastfetch-cli/fastfetch\fR for more information.
+51 -49
View File
@@ -35,14 +35,14 @@
"oneOf": [
{
"type": "number",
"description": "1 for percentage number, 2 for multi-color bar, 3 for both, 6 for bar only, 9 for colored number, 10 for monochrome bar",
"description": "0 to use global setting, 1 for percentage number, 2 for multi-color bar, 3 for both, 6 for bar only, 9 for colored number, 10 for monochrome bar",
"minimum": 0,
"maximum": 255,
"default": 9
},
{
"type": "array",
"description": "array of string flags",
"description": "Array of string flags",
"items": {
"enum": [
"num",
@@ -60,7 +60,7 @@
]
},
"percent": {
"description": "Threshold of percentage colors",
"description": "Thresholds for percentage colors",
"type": "object",
"additionalProperties": false,
"properties": {
@@ -68,13 +68,13 @@
"type": "integer",
"minimum": 0,
"maximum": 100,
"description": "Value less then green will be shown in green"
"description": "Values less than green will be shown in green"
},
"yellow": {
"type": "integer",
"minimum": 0,
"maximum": 100,
"description": "Value greater than green and less then yellow will be shown in yellow.\nValue greater than yellow will be shown in red"
"description": "Values greater than green and less than yellow will be shown in yellow.\nValues greater than yellow will be shown in red"
},
"type": {
"$ref": "#/$defs/percentType"
@@ -96,13 +96,13 @@
"type": "integer",
"minimum": 0,
"maximum": 100,
"description": "Value (in celsius) less then green will be shown in green"
"description": "Values (in celsius) less than green will be shown in green"
},
"yellow": {
"type": "integer",
"minimum": 0,
"maximum": 100,
"description": "Value (in celsius) greater than green and less then yellow will be shown in yellow.\nValue greater than yellow will be shown in red"
"description": "Values (in celsius) greater than green and less than yellow will be shown in yellow.\nValues greater than yellow will be shown in red"
}
}
}
@@ -131,11 +131,11 @@
"type": "string"
},
"bootmgrFormat": {
"description": "Output format of the module `Bootmgr`. See `-h format` for formatting syntax\n 1. {name}: Name / description\n 2. {firmware-path}: Firmware file path\n 3. {firmware-name}: Firmware file name\n 4. {secure-boot}: Is secure boot enabled",
"description": "Output format of the module `Bootmgr`. See `-h format` for formatting syntax\n 1. {name}: Name / description\n 2. {firmware-path}: Firmware file path\n 3. {firmware-name}: Firmware file name\n 4. {secure-boot}: Is secure boot enabled\n 5. {order}: Boot order",
"type": "string"
},
"brightnessFormat": {
"description": "Output format of the module `Brightness`. See `-h format` for formatting syntax\n 1. {percentage}: Screen brightness (percentage num)\n 2. {name}: Screen name\n 3. {max}: Maximum brightness value\n 4. {min}: Minimum brightness value\n 5. {current}: Current brightness value\n 6. {percentage-bar}: Screen brightness (percentage bar)",
"description": "Output format of the module `Brightness`. See `-h format` for formatting syntax\n 1. {percentage}: Screen brightness (percentage num)\n 2. {name}: Screen name\n 3. {max}: Maximum brightness value\n 4. {min}: Minimum brightness value\n 5. {current}: Current brightness value\n 6. {percentage-bar}: Screen brightness (percentage bar)\n 7. {is-builtin}: Is built-in screen",
"type": "string"
},
"btrfsFormat": {
@@ -207,7 +207,7 @@
"type": "string"
},
"gpuFormat": {
"description": "Output format of the module `GPU`. See `-h format` for formatting syntax\n 1. {vendor}: GPU vendor\n 2. {name}: GPU name\n 3. {driver}: GPU driver\n 4. {temperature}: GPU temperature\n 5. {core-count}: GPU core count\n 6. {type}: GPU type\n 7. {dedicated-total}: GPU total dedicated memory\n 8. {dedicated-used}: GPU used dedicated memory\n 9. {shared-total}: GPU total shared memory\n 10. {shared-used}: GPU used shared memory\n 11. {platform-api}: The platform API used when detecting the GPU\n 12. {frequency}: Current frequency in GHz\n 13. {index}: GPU vendor specific index\n 14. {dedicated-percentage-num}: Dedicated memory usage percentage num\n 15. {dedicated-percentage-bar}: Dedicated memory usage percentage bar\n 16. {shared-percentage-num}: Shared memory usage percentage num\n 17. {shared-percentage-bar}: Shared memory usage percentage bar\n 18. {core-usage-num}: Core usage percentage num (supports Nvidia & Apple GPU only)\n 19. {core-usage-bar}: Core usage percentage bar (supports Nvidia & Apple GPU only)",
"description": "Output format of the module `GPU`. See `-h format` for formatting syntax\n 1. {vendor}: GPU vendor\n 2. {name}: GPU name\n 3. {driver}: GPU driver\n 4. {temperature}: GPU temperature\n 5. {core-count}: GPU core count\n 6. {type}: GPU type\n 7. {dedicated-total}: GPU total dedicated memory\n 8. {dedicated-used}: GPU used dedicated memory\n 9. {shared-total}: GPU total shared memory\n 10. {shared-used}: GPU used shared memory\n 11. {platform-api}: The platform API used when detecting the GPU\n 12. {frequency}: Current frequency in GHz\n 13. {index}: GPU vendor specific index\n 14. {dedicated-percentage-num}: Dedicated memory usage percentage num\n 15. {dedicated-percentage-bar}: Dedicated memory usage percentage bar\n 16. {shared-percentage-num}: Shared memory usage percentage num\n 17. {shared-percentage-bar}: Shared memory usage percentage bar\n 18. {core-usage-num}: Core usage percentage num\n 19. {core-usage-bar}: Core usage percentage bar\n 20. {memory-type}: Memory type (Windows only)",
"type": "string"
},
"hostFormat": {
@@ -394,7 +394,7 @@
"type": "object",
"additionalProperties": false,
"title": "JSON config",
"description": "JSON config file for fastfetch. Usually be `~/.config/fastfetch.jsonc`",
"description": "JSON config file for fastfetch. Usually located at `~/.config/fastfetch/config.jsonc`",
"properties": {
"$schema": {
"type": "string",
@@ -420,7 +420,7 @@
"additionalProperties": false,
"properties": {
"type": {
"description": "Set the type of the logo given",
"description": "Set the type of the logo",
"enum": [
"auto",
"builtin",
@@ -447,7 +447,7 @@
"color": {
"type": "object",
"additionalProperties": false,
"description": "Overwrite a color in the logo",
"description": "Override colors in the logo",
"properties": {
"1": {
"description": "Color 1",
@@ -521,12 +521,12 @@
},
"printRemaining": {
"type": "boolean",
"description": "Whether to print the remaining logo, if it has more lines than modules to display",
"default": false
"description": "Whether to print the remaining logo if it has more lines than modules to display",
"default": true
},
"preserveAspectRatio": {
"type": "boolean",
"description": "Whether to preserve the aspect ratio of the logo. Supported by iTerm image protocol",
"description": "Whether to preserve the aspect ratio of the logo. Supported by iTerm image protocol only",
"default": false
},
"recache": {
@@ -536,7 +536,7 @@
},
"position": {
"type": "string",
"description": "Set the position of the logo should be displayed",
"description": "Set the position where the logo should be displayed",
"enum": [
"left",
"top",
@@ -547,7 +547,7 @@
"chafa": {
"type": "object",
"additionalProperties": false,
"description": "Chafa configuration. See chafa document for details",
"description": "Chafa configuration. See chafa documentation for details",
"properties": {
"fgOnly": {
"type": "boolean",
@@ -560,7 +560,7 @@
},
"canvasMode": {
"type": "string",
"description": "Determine how colors are used in the output. This value maps the value of enum ChafaCanvasMode.",
"description": "Determine how colors are used in the output. This value maps to enum ChafaCanvasMode.",
"enum": [
"TRUECOLOR",
"INDEXED_256",
@@ -574,7 +574,7 @@
},
"colorSpace": {
"type": "string",
"description": "Set color space used for quantization. This value maps the value of enum ChafaColorSpace.",
"description": "Set color space used for quantization. This value maps to enum ChafaColorSpace.",
"enum": [
"RGB",
"DIN99D"
@@ -582,7 +582,7 @@
},
"ditherMode": {
"type": "string",
"description": "Set output dither mode (No effect with 24-bit color). This value maps the value of enum ChafaDitherMode.",
"description": "Set output dither mode (No effect with 24-bit color). This value maps to enum ChafaDitherMode.",
"enum": [
"NONE",
"ORDERED",
@@ -600,14 +600,9 @@
"type": "object",
"additionalProperties": false,
"properties": {
"multithreading": {
"type": "boolean",
"description": "Use multiple threads to detect values",
"default": true
},
"thread": {
"type": "boolean",
"description": "Alias of multithreading",
"description": "Use separate threads for HTTP requests",
"default": true
},
"escapeBedrock": {
@@ -617,7 +612,7 @@
},
"playerName": {
"type": "string",
"description": "The name of the player to use for module Media and Player. Linux only"
"description": "The name of the player to use for Media and Player modules. Linux only"
},
"dsForceDrm": {
"description": "Force display detection to use DRM. Linux only",
@@ -629,13 +624,13 @@
},
{
"type": "string",
"description": "Use `/sys/class/drm` only.",
"description": "Use `/sys/class/drm` only",
"const": "sysfs-only"
},
{
"type": "boolean",
"const": true,
"description": "Try `libdrm` first, then `sysfs` if libdrm failed"
"description": "Try `libdrm` first, then `sysfs` if libdrm fails"
}
],
"default": false
@@ -663,7 +658,7 @@
}
},
"display": {
"description": "Configure how things to be displayed",
"description": "Configure how things should be displayed",
"type": "object",
"additionalProperties": false,
"properties": {
@@ -682,7 +677,7 @@
},
"pipe": {
"type": "boolean",
"description": "Whether to enable pipe mode (disable logo and all escape sequences)",
"description": "Whether to disable colors (auto-detected based on isatty(1) by default)",
"default": false
},
"showErrors": {
@@ -692,12 +687,12 @@
},
"disableLinewrap": {
"type": "boolean",
"description": "Whether to disable line wrap during the run",
"description": "Whether to disable line wrap during execution",
"default": true
},
"hideCursor": {
"type": "boolean",
"description": "Whether to hide the cursor during the run",
"description": "Whether to hide the cursor during execution",
"default": true
},
"separator": {
@@ -709,7 +704,7 @@
"description": "Set the color of the keys and title",
"oneOf": [
{
"description": "Set the both color of the keys and title",
"description": "Set both the colors of keys and title",
"$ref": "#/$defs/colors"
},
{
@@ -774,11 +769,11 @@
"size": {
"type": "object",
"additionalProperties": false,
"description": "Set how a size value should be displayed",
"description": "Set how size values should be displayed",
"properties": {
"binaryPrefix": {
"type": "string",
"description": "Set the binary prefix to used when formatting sizes",
"description": "Set the binary prefix to use when formatting sizes",
"oneOf": [
{
"const": "iec",
@@ -792,7 +787,8 @@
"const": "jedec",
"description": "1024 Bytes = 1 KB, 1024 KB = 1 MB, ..."
}
]
],
"default": "iec"
},
"maxPrefix": {
"type": "string",
@@ -816,7 +812,7 @@
"properties": {
"unit": {
"type": "string",
"description": "Set the unit of the temperature",
"description": "Set the unit of temperature",
"enum": ["D", "Default", "Celsius", "C", "Fahrenheit", "F", "Kelvin", "K"],
"default": "D"
},
@@ -830,19 +826,22 @@
"color": {
"type": "object",
"additionalProperties": false,
"description": "Set color used in different states of temperature values",
"description": "Set colors used in different states of temperature values",
"properties": {
"green": {
"description": "Color used in green state",
"$ref": "#/$defs/colors"
"$ref": "#/$defs/colors",
"default": "green"
},
"yellow": {
"description": "Color used in yellow state",
"$ref": "#/$defs/colors"
"$ref": "#/$defs/colors",
"default": "light_yellow"
},
"red": {
"description": "Color used in red state",
"$ref": "#/$defs/colors"
"$ref": "#/$defs/colors",
"default": "light_red"
}
}
}
@@ -884,7 +883,7 @@
"percent": {
"type": "object",
"additionalProperties": false,
"description": "Set how a percentage value should be displayed",
"description": "Set how percentage values should be displayed",
"properties": {
"type": {
"$ref": "#/$defs/percentType"
@@ -899,19 +898,22 @@
"color": {
"type": "object",
"additionalProperties": false,
"description": "Set color used in different states of percentage bars and numbers",
"description": "Set colors used in different states of percentage bars and numbers",
"properties": {
"green": {
"description": "Color used in green state",
"$ref": "#/$defs/colors"
"$ref": "#/$defs/colors",
"default": "green"
},
"yellow": {
"description": "Color used in yellow state",
"$ref": "#/$defs/colors"
"$ref": "#/$defs/colors",
"default": "light_yellow"
},
"red": {
"description": "Color used in red state",
"$ref": "#/$defs/colors"
"$ref": "#/$defs/colors",
"default": "light_red"
}
}
}
@@ -924,7 +926,7 @@
"properties": {
"ndigits": {
"type": "integer",
"description": "Set the number of digits to keep after the decimal point when formatting frequency values\nA positive value will show the frequency in GHz of decimal\n-1 will show the frequency in MHz",
"description": "Set the number of digits to keep after the decimal point when formatting frequency values\nA positive value will show the frequency in GHz with decimal\n-1 will show the frequency in MHz",
"minimum": -1,
"maximum": 9,
"default": 2
+125 -52
View File
@@ -1,11 +1,15 @@
#!/usr/bin/env python3
"""
Python script to generate a man page for the command `fastfetch`.
The man content will be printed to stdout so you will need to
pipe it to a file if you want to save it.
The command options will be generated using a JSON file.
For the format of the JSON file, see https://github.com/fastfetch-cli/fastfetch/blob/dev/src/data/help.json
Python script to generate a comprehensive man page for the command `fastfetch`.
The generated man page content will be printed to stdout,
so you will need to pipe it to a file if you want to save it.
Example: python3 gen-man.py > fastfetch.1
The command options are generated using a JSON file.
For the JSON file format, see:
https://github.com/fastfetch-cli/fastfetch/blob/dev/src/data/help.json
"""
from json import load
@@ -33,7 +37,7 @@ pathToHelpFile = path.join(pathToCurrentDir, "../src/data/help.json")
# man page section
manSection = 1
# title (center header)
titlePage = "Fastfetch man page"
titlePage = "FASTFETCH"
# date (center footer)
# format : "Month (abbreviation) Day Year"
todayDate = datetime.fromtimestamp(
@@ -47,81 +51,118 @@ pathToVersionFile = path.join(pathToCurrentDir, "../CMakeLists.txt")
###### Sections Text ######
# text displayed in the "NAME" section
nameSection = r"fastfetch \- A maintained, feature\-rich and performance oriented, neofetch like system information tool"
nameSection = r"fastfetch \- A fast and feature-rich system information tool similar to neofetch"
# text displayed in the "DESCRIPTION" section
descriptionSection = r"""
Fastfetch is a tool for displaying system information in a visually appealing way. Written primarily in C, it focuses on performance and customizability while providing functionality similar to neofetch.
It supports Linux, Android, FreeBSD, macOS, and Windows 7 or newer.
"""
# text displayed at the beginning of the "OPTIONS" section
optionSection = r"""
Parsing is not case sensitive. E.g. \fB--logo-type\fR is
equal to \fB--LOGO-TYPE\fR.
Options are parsed in a case-insensitive manner. For example, \fB--logo-type\fR and \fB--LOGO-TYPE\fR are treated identically.
If a value is between square brackets, it is optional.
An optional boolean value defaults to true if not specified.
Arguments in square brackets are optional. Optional boolean arguments default to 'true' when specified without a value.
More detailed help messages for each options can be printed
with \fB-h <option_without_dash_prefix>\fR.
For more detailed information about a specific option, use:
\fBfastfetch -h <option_name_without_dashes>\fR
All options can be made permanent with command
\fBfastfetch <options> --gen-config\fR.
Any combination of options can be made permanent by generating a configuration file:
\fBfastfetch <options> --gen-config\fR
"""
# text displayed in the "CONFIGURATION"
configurationSection = f"""
.SS Fetch Structure
The structure of a fetch describes the modules that should
be included in the output. It consists of a string of modules,
separated by a colon (:). To list all available modules,
use --list-modules.
The structure defines which modules to display and in what order. It consists of module names separated by colons (:).
For example: {startBold}title:separator:os:kernel:uptime{endBold}
To list all available modules, use {startBold}--list-modules{endBold}
.SS Config Files
Fastfetch uses JSONC based format for configuration.
Fastfetch doesn't generate config file automatically;
it should be generated manually by {startBold}--gen-config{endBold}.
The config file will be saved in
{startBold}~/.config/fastfetch/config.jsonc{endBold} by default.
Fastfetch uses JSONC (JSON with Comments) for configuration files. These files must have the .jsonc extension.
A JSONC config file is a JSON file that also supports comments
with (// and /* */). Those files must have the extension '.jsonc'.
You can generate a default config file using {startBold}--gen-config{endBold}. By default, the config file is saved at {startBold}~/.config/fastfetch/config.jsonc{endBold}.
The specified configuration/preset files are searched in the following order:
The configuration/preset files are searched in the following locations (in order):
{startBold}1.{endBold} relative to the current working directory
{startBold}1.{endBold} Relative to the current working directory
{startBold}2.{endBold} relative to ~/.local/share/fastfetch/presets/
{startBold}2.{endBold} Relative to ~/.local/share/fastfetch/presets/
{startBold}3.{endBold} relative to /usr/share/fastfetch/presets/
{startBold}3.{endBold} Relative to /usr/share/fastfetch/presets/
Fastfetch provides some default presets. List them with --list-presets.
For detailed information on logo options, module configuration, and formatting, visit:
{startBold}https://github.com/fastfetch-cli/fastfetch/wiki/Configuration{endBold}
Fastfetch provides several built-in presets. List them with {startBold}--list-presets{endBold}.
.SS JSON Schema
A JSON schema is available for editor intelligence when editing the configuration file. Add the following line at the beginning of your config file:
{startBold}"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json"{endBold}
"""
# text displayed in the "EXAMPLE" section
exampleSection = """
.SS Config files:
exampleSection = f"""
.SS Basic Usage
{startBold}fastfetch{endBold}
.SS Use a specific logo
{startBold}fastfetch --logo arch{endBold}
.SS Custom structure
{startBold}fastfetch --structure title:os:kernel:uptime:memory{endBold}
.SS Generate a config file
{startBold}fastfetch --gen-config{endBold}
.SS Use a preset
{startBold}fastfetch --config neofetch{endBold}
.SS Config File Example
.nf
// ~/.config/fastfetch/config.jsonc
{
{{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {{
"type": "auto",
"source": "arch"
}},
"display": {{
"separator": ": ",
"color": {{
"keys": "blue",
"title": "red"
}},
"key": {{
"width": 12
}}
}},
"modules": [
"title",
"separator",
"module1",
{
"type": "module2",
"module2-option": "value"
}
"os",
"kernel",
"uptime",
{{
"type": "memory",
"format": "{{used}}/{{total}} ({{used_percent}}%)"
}}
]
}
}}
.fi
"""
# text displayed in the "BUGS" section
bugSection = "Please report bugs to : \
https://github.com/fastfetch-cli/fastfetch/issues"
bugSection = "Please report bugs to: https://github.com/fastfetch-cli/fastfetch/issues"
# text displayed in the "WIKI" section
wikiSection = "Fastfetch github wiki : https://github.com/fastfetch-cli/fastfetch/wiki/Configuration"
# text displayed in the "AUTHORS" section
authorsSection = "Fastfetch is developed by a team of contributors on GitHub.\nVisit https://github.com/fastfetch-cli/fastfetch for more information."
###### Argument decoration ######
@@ -130,7 +171,7 @@ wikiSection = "Fastfetch github wiki : https://github.com/fastfetch-cli/fastfetc
# if an optional argument is displayed as [?optArg] (with "optArg" underlined)
# this value should be f"[?{startUnderline}"
startOptionalArgument = f"[{startUnderline}?"
startOptionalArgument = f"[{startUnderline}"
# if an optional argument is displayed as [?optArg] (with "optArg underlined")
# this value should be f"{endUnderline}]"
endOptionalArgument = f"{endUnderline}]"
@@ -161,7 +202,7 @@ def main():
for line in versionFile:
researchVersion = search(r"^\s*VERSION (\d+\.\d+\.\d+)$", line)
if (researchVersion):
print(f"\"{researchVersion.group(1)}\"", end=" ")
print(f"\"Fastfetch {researchVersion.group(1)}\"", end=" ")
break
print(f"\"{titlePage}\"")
@@ -177,13 +218,13 @@ def main():
print(".SH SYNOPSIS")
print(".B fastfetch")
print(f"[{startUnderline}OPTIONS{endUnderline}]")\
print(f"[{startUnderline}OPTIONS{endUnderline}...]")
###### Wiki ######
###### Description ######
print(".SH WIKI")
print(wikiSection)
print(".SH DESCRIPTION")
print(descriptionSection)
###### Configuration ######
@@ -202,7 +243,7 @@ def main():
for key, value in helpFileData.items():
# print new subsection
print(f".SS {key}:")
print(f".SS {key}")
# loop through every option in a section
for option in value:
@@ -237,7 +278,29 @@ def main():
print(startMandatoryArgument + option['arg']['type'] + endMandatoryArgument, end="")
# description
print(f"\n {option['desc']} \n")
print()
# If desc is a list, join with newlines and proper spacing
if isinstance(option['desc'], list):
desc_text = "\n ".join(option['desc'])
print(f" {desc_text}")
else:
print(f" {option['desc']}")
# Add remarks if available
if "remark" in keyList:
print()
if isinstance(option['remark'], list):
for remark in option['remark']:
print(f" {remark}")
else:
print(f" {option['remark']}")
# Add default value if available
if "arg" in keyList and "default" in option["arg"]:
print(f" Default: {option['arg']['default']}")
print()
###### Examples ######
@@ -246,12 +309,22 @@ def main():
print(exampleSection)
###### See Also ######
print(".SH \"SEE ALSO\"")
print(".BR neofetch (1)")
###### Bugs ######
print(".SH BUGS")
print(bugSection)
###### Authors ######
print(".SH AUTHORS")
print(authorsSection)
if __name__ == "__main__":
+154 -157
View File
File diff suppressed because it is too large Load Diff
+13 -12
View File
@@ -1,24 +1,25 @@
Usage: fastfetch --color <color>
Shortcut of `fastfetch --color-keys <color> --color-title <color>`.
If no color is set, the main color of the logo will be used.
This is a shortcut for `fastfetch --color-keys <color> --color-title <color>`.
If no color is specified, the main color of the logo will be used.
Following information applies to all settings
The following information applies to all color settings:
<color> must be a color encoding in ANSI escape sequence format. It is inserted between "ESC[" and "m".
More information about ANSI escape codes can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
<color> must be a color encoding as ANSI escape sequences. It is inserted between "ESC[" and "m".
Infos about them can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
Examples:
35: sets the color to magenta
38;5;38: sets the color to 38th color of ANSI 256 colors
38;5;38: sets the color to the 38th color in the ANSI 256 color palette
4;92: sets the color to bright green with underline
5;104: blinking text on a blue background
5;104: sets blinking text on a blue background
ANSI named colors are also supported:
magenta: equivalent to `35`
underline_bright_green: equivalent to `4;92`
After v2.15.0, some special keys can be used:
keys: use the color set by `--color-keys`
title: use the color set by `--color-title`
output: use the color set by `--color-output`
separator: use the color set by `--color-separator`
Since v2.15.0, the following special keywords can be used:
keys: uses the color set by `--color-keys`
title: uses the color set by `--color-title`
output: uses the color set by `--color-output`
separator: uses the color set by `--color-separator`
+1 -1
View File
@@ -1,4 +1,4 @@
Parsing is not case sensitive. E.g. "--lib-PCI" is equal to "--Lib-Pci"
Parsing is not case sensitive. E.g. "--print-logos" is equal to "--Print-Logos"
If a value starts with a ?, it is optional. An optional boolean value defaults to true if not specified.
More detailed help messages for each options can be printed with "-h <option_without_dash_prefix>"
All options can be made permanent with command "fastfetch <options> --gen-config"
+41 -40
View File
@@ -1,55 +1,56 @@
A format string is a string that contains placeholders for values.
These placeholders begin with a '{', containing the index of the value, and end with a '}'.
For example the format string "Values: {1} ({2})", with the values "First" and "My second val", will produce "Values: First (My second val)".
The format string can contain placeholders in any order and have multiple occurrences.
To include spaces when setting from the command line, surround the whole string with double quotes (").
A format string is a text string that contains placeholders for values.
These placeholders begin with a '{', contain the index of the value, and end with a '}'.
For example, the format string "Values: {1} ({2})" with the values "First" and "My second val" will produce "Values: First (My second val)".
Format strings can contain placeholders in any order and include multiple occurrences of the same placeholder.
When setting a format string from the command line that contains spaces, surround the entire string with double quotes (").
In 2.14.0 or newer, the value indices can be meaningful named tags.
For example: "--title-format '{user-name-colored}{at-symbol-colored}{host-name-colored}'" is equivalent to "--title-format '{6}{7}{8}'"
In version 2.14.0 or newer, value indices can be meaningful named tags.
For example: "--title-format '{user-name-colored}{at-symbol-colored}{host-name-colored}'" is equivalent to "--title-format '{6}{7}{8}'".
See "fastfetch -h title-format" for all supported tags.
In 2.17.0 or newer, a truncation length can be specified using syntax '<arg>:<trunc-length>`
For example: "--title-format '{user-name:5}'" will truncate user name into 5-length string.
If '<trunc-length>' is negative, an ellipsis will be appended at the end when the original string is truncated.
Note: The string length is counted in raw bytes. Multi-byte unicode characters and ANSI escape codes are not taken into account.
In version 2.17.0 or newer, a truncation length can be specified using the syntax '{arg:trunc-length}'.
For example: "--title-format '{user-name:5}'" will truncate the user name to a 5-character string.
If 'trunc-length' is negative, an ellipsis (…) will be appended when the string is truncated.
Note: String length is counted in raw bytes. Multi-byte Unicode characters and ANSI escape codes are not taken into account.
In 2.23.0 or newer, `<` or `>` can be specified instead of `:` to set a left or right padding.
For example: "--title-format '{user-name<20}'" will generate `<user-name> `;
"--title-format '{user-name>20}'" will generate ` <user-name>`
In version 2.23.0 or newer, '<' or '>' can be used instead of ':' to set left or right padding.
For example: "--title-format '{user-name<20}'" will generate `<user-name> ` (left-aligned with spaces),
while "--title-format '{user-name>20}'" will generate ` <user-name>` (right-aligned with spaces).
In 2.24.0 or newer, `{~startIndex,endIndex}` can be specified to slice a string. Negative index counts back from the end of the string.
If an index is omitted, 0 is used. For example, both `{~,0}` `{~0,}` and `{~,}` are same as `{~0,0}` and will always generate a empty string.
If `,endIndex` is omitted or greater than the length of the string, the length of string is used.
In version 2.24.0 or newer, '{~startIndex,endIndex}' can be specified to slice a string. Negative indices count backward from the end of the string.
If an index is omitted, 0 is used by default. For example, '{~,0}', '{~0,}', and '{~,}' are all equivalent to '{~0,0}' and will generate an empty string.
If ',endIndex' is omitted or greater than the string length, the length of the string is used instead.
In 2.36.0 or newer, `{$NUM}` can be specified to reference a constant defined in `display.constants`. `{$ENV_VAR}` can be specified to reference an environment variable.
In version 2.36.0 or newer, '{$NUM}' can be used to reference a constant defined in `display.constants`, and '{$ENV_VAR}' can be used to reference an environment variable.
If the value index is missing, meaning the placeholder is "{}", an internal counter sets the value index.
If a value index is missing (empty placeholder: "{}"), an internal counter automatically assigns the next sequential value.
This means that the format string "Values: {1} ({2})" is equivalent to "Values: {} ({})".
Note that this counter only counts empty placeholders, so the format string "{2} {} {}" will contain the second value, then the first, and then the second again.
Note that this counter only increments for empty placeholders, so the format string "{2} {} {}" will contain the second value, then the first, and then the second again.
To make formatting easier, a double open curly brace ("{{") will be printed as a single open curly brace and not counted as the beginning of a placeholder.
If a value index is misformatted or wants a non-existing value, it will be printed as is, with the curly braces around it.
If the last placeholder isn't closed, it will be treated like it was at the end of the format string.
To simplify formatting, a double open curly brace ("{{") will be printed as a single open curly brace ('{') and not be treated as the beginning of a placeholder.
If a value index is incorrectly formatted or references a non-existent value, it will be printed as-is with the curly braces preserved.
If the final placeholder is not closed, it will be treated as if it were closed at the end of the format string.
To only print something if a variable is set, use "{?<index>} ... {?}".
For example, to only print a second value if it is set, use "{?2} Second value: {2}{?}".
If a "{?}" is found without an opener, it is printed as is.
To conditionally print content only when a variable is set, use "{?<index>} ... {?}".
For example, to print a second value only if it is set, use "{?2} Second value: {2}{?}".
If a "{?}" is found without a corresponding opener, it is printed as-is.
To only print something if a variable is not set, do the same as with if, just replace every '?' with a '/'.
For example to print a fallback for a second value if it is not set, use "{?2}{2}{?}{/2}Second value fallback{/}".
To conditionally print content only when a variable is NOT set, use "{/<index>} ... {/}" (same syntax as above, but with '/' instead of '?').
For example, to print a fallback for a second value if it is not set, use "{?2}{2}{?}{/2}Second value fallback{/}".
To stop formatting at any point in the format string, use "{-}".
To terminate formatting at any point in the format string, use "{-}".
To print something with color, start a placeholder with a '#' and then the linux terminal color encoding.
"\033[" at the start, and an 'm' at the end is automatically added, so don't do that.
A "{#}" is equivalent to a "{#0}" and resets everything to normal.
For example to print something pink and underline, use "{#4;35}...{#}". "{#underline_magenta}" is also supported. See `fastfetch -h color` for detail.
Information about what the numbers mean can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
Which escape codes are supported and how they look is defined by your terminal.
To apply color to text, start a placeholder with '#' followed by Linux terminal color codes.
The escape sequence "\033[" at the start and 'm' at the end are automatically added, so you don't need to include them.
"{#}" is equivalent to "{#0}" and resets all formatting to normal.
For example, to print text in pink and underlined, use "{#4;35}...{#}". Named formats like "{#underline_magenta}" are also supported.
See `fastfetch -h color` for details about supported color codes.
Information about color code meanings can be found at: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
The supported escape codes and their appearance depend on your terminal.
If a format string evaluates to an empty value, the whole line in the output will be discarded.
You can therefore use --host-format " " to disable host output.
Note that --host-format "" would evaluate as not set, and therefore use the built-in host format
If a format string evaluates to an empty value, the entire line will be omitted from the output.
You can use this behavior to disable specific outputs, for example: "--host-format " " will disable host output.
Note that "--host-format ""' (empty string) would be treated as not set, and therefore the built-in host format would be used.
Format string is also the way to go to set a fixed value - just use one without placeholders.
For example when running in headless mode, you could use "--display-format Preferred".
Format strings can also be used to set fixed values—simply use a string without any placeholders.
For example, when running in headless mode, you could use "--display-format Preferred".