commit afaa452

Hubert Hirtz  ·  2021-11-23 08:21:09 +0000 UTC
parent b469005
Tidy things
2 files changed,  +22, -29
+1, -9
 1@@ -106,7 +106,7 @@ func Defaults() (cfg Config, err error) {
 2 	return
 3 }
 4 
 5-func ParseConfig(filename string) (cfg Config, err error) {
 6+func LoadConfigFile(filename string) (cfg Config, err error) {
 7 	cfg, err = Defaults()
 8 	if err != nil {
 9 		return
10@@ -131,14 +131,6 @@ func ParseConfig(filename string) (cfg Config, err error) {
11 	return
12 }
13 
14-func LoadConfigFile(filename string) (cfg Config, err error) {
15-	cfg, err = ParseConfig(filename)
16-	if err != nil {
17-		return cfg, fmt.Errorf("invalid content found in the file: %s", err)
18-	}
19-	return
20-}
21-
22 func unmarshal(filename string, cfg *Config) (err error) {
23 	directives, err := scfg.Load(filename)
24 	if err != nil {
+21, -20
 1@@ -6,8 +6,8 @@ senpai - Configuration file format and settings
 2 
 3 # DESCRIPTION
 4 
 5-A senpai configuration file is a scfg file (see https://git.sr.ht/~emersion/scfg).
 6-The config file has one directive per line.
 7+A senpai configuration file is a scfg file.
 8+See https://git.sr.ht/~emersion/scfg.
 9 
10 Some settings are required, the others are optional.
11 
12@@ -43,29 +43,30 @@ Some settings are required, the others are optional.
13 	will be ignored and the output of *password-cmd* will be used for login.
14 
15 *channel*
16-	A spaced separated list of channel names that senpai will automatically join 
17-	at startup and server reconnect. This directive can be specified multiple times.
18+	A spaced separated list of channel names that senpai will automatically join
19+	at startup and server reconnect. This directive can be specified multiple
20+	times.
21 
22 *highlight*
23-	A space separated list of keywords that will trigger a notification and a 
24+	A space separated list of keywords that will trigger a notification and a
25 	display indicator when said by others. This directive can be specified
26 	multiple times.
27 
28 	By default, senpai will use your current nickname.
29 
30 *on-highlight-path*
31-	Alternative path to a shell script to be executed when you are highlighted. By default,
32-	senpai looks for a highlight shell script at $XDG_CONFIG_HOME/senpai/highlight.
33-	If no file is found at that path, and an alternate path is not provided,
34-	highlight command execution is disabled.
35+	Alternative path to a shell script to be executed when you are highlighted.
36+	By default, senpai looks for a highlight shell script at
37+	$XDG_CONFIG_HOME/senpai/highlight. If no file is found at that path, and an
38+	alternate path is not provided, highlight command execution is disabled.
39 
40 	If unset, $XDG_CONFIG_HOME defaults to *~/.config/*.
41 
42 	Before the highlight script is executed, the following environment
43 	variables are populated:
44-	
45+
46 	Shell scripts MUST ENSURE VARIABLES appear QUOTED in the script file,
47-	OR YOU WILL BE OPEN TO SHELL INJECTION ATTACKS. Shell scripts must also 
48+	OR YOU WILL BE OPEN TO SHELL INJECTION ATTACKS. Shell scripts must also
49 	ensure characters like '\*' and '?' are not expanded.
50 
51 [[ *Environment variable*
52@@ -95,7 +96,7 @@ notify-send "[$BUFFER] $SENDER" "$(escape "$MESSAGE")"
53 ```
54 
55 *pane-widths* { ... }
56-	Configure the width of various UI panes. 
57+	Configure the width of various UI panes.
58 
59 	Pane widths are set as sub-directives of the main *pane-widths* directive:
60 
61@@ -108,23 +109,23 @@ pane-widths {
62 	This directive supports the following sub-directives:
63 
64 	*nicknames*
65-		The number of cells that the column for nicknames occupies in the timeline.
66-		By default, 16.
67+		The number of cells that the column for nicknames occupies in the
68+		timeline. By default, 16.
69 
70 	*channels*
71-		Make the channel list vertical, with a width equals to the given amount of
72-		cells.  By default, the channel list is horizontal.
73+		Make the channel list vertical, with a width equals to the given amount
74+		of cells.  By default, the channel list is horizontal.
75 
76 	*members*
77-		Show the list of channel members on the right of the screen, with a width
78-		equals to the given amount of cells.
79+		Show the list of channel members on the right of the screen, with a
80+		width equals to the given amount of cells.
81 
82 *tls*
83 	Enable TLS encryption.  Defaults to true.
84 
85 *typings*
86-	Send typing notifications which let others know when you are typing a message.
87-	Defaults to true.
88+	Send typing notifications which let others know when you are typing a
89+	message. Defaults to true.
90 
91 *mouse*
92 	Enable or disable mouse support.  Defaults to true.