Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation with JSON config file #25

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@ The command should be used as `hevi <file> [flags]`. The flags are described [be
The `NO_COLOR` variable is supported, and disables color (see <https://no-color.org/>) printing. Note that it can be overwritten by an explicit `--color`.

### Config file
You can create a config file and specify the default values for the flags. It follows the `.zon` syntax. Example:
```zig
.{
.color = true,
.uppercase = true,
.show_size = false,
.show_offset = true,
.show_ascii = false,
.skip_lines = true,
.parser = "data",
You can create a config file and specify the default values for the flags. It follows the `.json` syntax. Example:
```json
{
"color": true,
"uppercase": true,
"show_size": false,
"show_offset": true,
"show_ascii": false,
"skip_lines": true,
"parser": "data"
}
```

The config file is located at:
| OS | Path |
| -------------------------------------- | ----------------------------------------------------------------------------------------------- |
| Linux, MacOS, FreeBSD, OpenBSD, NetBSD | `$XDG_CONFIG_HOME/hevi/config.zon` or if the env doesn't exist `$HOME/.config/hevi/config.zon` |
| Windows | `%APPDATA%/hevi/config.zon` |
| Other | Not supported. No config file will be read |
| OS | Path |
| -------------------------------------- | ------------------------------------------------------------------------------------------------ |
| Linux, MacOS, FreeBSD, OpenBSD, NetBSD | `$XDG_CONFIG_HOME/hevi/config.json` or if the env doesn't exist `$HOME/.config/hevi/config.json` |
| Windows | `%APPDATA%/hevi/config.json` |
| Other | Not supported. No config file will be read |

**Note**: hevi has a precedence for configuration and is:
1. Flags
Expand Down
2 changes: 1 addition & 1 deletion doc/hevi.1.man
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ output version information and exit

.SH FILES
.TP
.I \[ti]/.config/hevi/config.zon
.I \[ti]/.config/hevi/config.json
The main configuration file. See also
.BR hevi (5)

Expand Down
30 changes: 15 additions & 15 deletions doc/hevi.5.man
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
hevi configuration file

.SH SYNOPSIS
.I ~/.config/hevi/config.zon
.I ~/.config/hevi/config.json

.SH DESCRIPTION
This page explains how the configuration file is structured and what its fields are.

The configuration file is a zon file, a sort of zig anonymous struct.
The configuration file is a JSON file.

These are the fields of the configuration file:
.in +4
.nf
color = \fItrue\fR|\fIfalse\fR
uppercase = \fItrue\fR|\fIfalse\fR
show_size = \fItrue\fR|\fIfalse\fR
show_offset = \fItrue\fR|\fIfalse\fR
show_ascii = \fItrue\fR|\fIfalse\fR
show_lines = \fItrue\fR|\fIfalse\fR
parser = "\fIspecific parser\fR"
color: \fItrue\fR|\fIfalse\fR
uppercase: \fItrue\fR|\fIfalse\fR
show_size: \fItrue\fR|\fIfalse\fR
show_offset: \fItrue\fR|\fIfalse\fR
show_ascii: \fItrue\fR|\fIfalse\fR
show_lines: \fItrue\fR|\fIfalse\fR
parser: "\fIspecific parser\fR"
.fi
.in

Expand All @@ -28,18 +28,18 @@ You can also not put all the fields in the file, default values will be chosen.
The config file is located at:
.in +4
.nf
\fBLinux\fR, \fBMacOS\fR, \fBFreeBSD\fR, \fBOpenBSD\fR, \fBNetBSD\fR --> \fI$XDG_CONFIG_HOME/hevi/config.zon\fR or if the env doesn't exist \fI$HOME/.config/hevi/config.zon\fR
\fBWindows\fR --> \fI%APPDATA%/hevi/config.zon\fR
\fBLinux\fR, \fBMacOS\fR, \fBFreeBSD\fR, \fBOpenBSD\fR, \fBNetBSD\fR --> \fI$XDG_CONFIG_HOME/hevi/config.json\fR or if the env doesn't exist \fI$HOME/.config/hevi/config.json\fR
\fBWindows\fR --> \fI%APPDATA%/hevi/config.json\fR
\fBOther\fR --> Not supported. No config file will be read.
.in

.SH EXAMPLES
.in +4
.EX
\%.{
.color = true,
.skip_lines = false,
.parser = "data",
{
"color": true,
"skip_lines": false,
"parser": "data"
}
.EE
.in
Expand Down