~taiite/senpai#66: 
use scfg instead of yaml for configuration

senpai was made before go-scfg came up, thus the choice of yaml for configuration. However, scfg is simpler to parse and doesn't do magic with its input, so I suppose will be nicer to use with senpai.

We can use this opportunity to improve consistency of configuration keys: this configuration

addr: 192.168.0.64
no-tls: true
nick: jbezoz
real: Jeej Bezoz
password: Show unread messages on start

highlights:
    - bezoz
    - senpai
    - github

on-highlight: |
    echo "<$SENDER> $MESSAGE"
    exit 1

nick-column-width: 9
chan-column-width: 15
member-column-width: 16
mouse: false
no-typings: true

could become

address  192.168.0.64
tls      false
nickname jbezoz
realname "Jeej Bezoz"
password "Show unread messages on start"
password-cmd gopass show soju

highlight bezoz
highlight senpai github

nickname-column-width 9
channel-column-width 15
member-column-width 16
mouse false
typings {
    send false
    show true
}

Since scfg doesn't support multi-line values, on-highlight would need to be a separate, executable file that is to be executed with the same environment variables as now, e.g. ~/.config/senpai/highlight

#!/bin/sh
echo "<$SENDER> $MESSAGE"
exit 1

Another solution could be to replicate password-cmd behavior, but it would either not allow environment variables in the command, or force usage of escapes..

Status
RESOLVED FIXED
Submitter
~taiite
Assigned to
Submitted
6 months ago
Updated
2 months ago
Labels
enhancement

~coder_kalyan 3 months ago

I'm going to take this up, already have a draft on my local machine.

Register here or Log in to comment, or comment via email.