Browse Source

Update config to be more uniform

pull/34/head
Sam 5 years ago
parent
commit
99922c2582
  1. 17
      defaultConfig.go
  2. 19
      kbtui.toml
  3. 37
      types.go

17
defaultConfig.go

@ -2,23 +2,24 @@ package main @@ -2,23 +2,24 @@ package main
var defaultConfig = `
[basics]
downloadPath = "/tmp/"
download_path = "/tmp/"
colorless = false
# The prefix before evaluating a command
cmdPrefix = "/"
cmd_prefix = "/"
[formatting]
# BASH-like PS1 variable equivalent
outputFormat = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
outputStreamFormat = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
outputMentionFormat = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
pmFormat = "PM from $USER@$DEVICE: $MSG"
output_format = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
output_stream_format = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
output_mention_format = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
pm_format = "PM from $USER@$DEVICE: $MSG"
# 02 = Day, Jan = Month, 06 = Year
dateFormat = "02Jan06"
date_format = "02Jan06"
# 15 = hours, 04 = minutes, 05 = seconds
timeFormat = "15:04"
time_format = "15:04"
[colors]

19
kbtui.toml

@ -1,21 +1,22 @@ @@ -1,21 +1,22 @@
[basics]
downloadPath = "/tmp/"
download_path = "/tmp/"
colorless = false
# The prefix before evaluating a command
cmdPrefix = "/"
cmd_prefix = "/"
[formatting]
# BASH-like PS1 variable equivalent
outputFormat = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
outputStreamFormat = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
outputMentionFormat = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
pmFormat = "PM from $USER@$DEVICE: $MSG"
output_format = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
output_stream_format = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
output_mention_format = "┌──[$USER@$DEVICE] [$ID] [$DATE - $TIME]\n└╼ $MSG"
pm_format = "PM from $USER@$DEVICE: $MSG"
# 02 = Day, Jan = Month, 06 = Year
dateFormat = "02Jan06"
date_format = "02Jan06"
# 15 = hours, 04 = minutes, 05 = seconds
timeFormat = "15:04"
time_format = "15:04"
[colors]
@ -63,4 +64,4 @@ timeFormat = "15:04" @@ -63,4 +64,4 @@ timeFormat = "15:04"
[colors.feed.basic]
foreground = "grey"
[colors.feed.error]
foreground = "red"
foreground = "red"

37
types.go

@ -20,27 +20,37 @@ type TypeCommand struct { @@ -20,27 +20,37 @@ type TypeCommand struct {
// Config holds user-configurable values
type Config struct {
filepath string `toml:"-"`
filepath string `toml:"-"` // filepath is not stored in the config file, but is written to the Config struct so it's known where the config was loaded from
Basics Basics `toml:"basics"`
Formatting Formatting `toml:"formatting"`
Colors Colors `toml:"colors"`
}
// Basics holds the 'basics' section of the config file
type Basics struct {
DownloadPath string `toml:"downloadPath"`
DownloadPath string `toml:"download_path"`
Colorless bool `toml:"colorless"`
CmdPrefix string `toml:"cmdPrefix"`
CmdPrefix string `toml:"cmd_prefix"`
}
// Formatting holds the 'formatting' section of the config file
type Formatting struct {
OutputFormat string `toml:"outputFormat"`
OutputStreamFormat string `toml:"outputStreamFormat"`
OutputMentionFormat string `toml:"outputMentionFormat"`
PMFormat string `toml:"pmFormat"`
DateFormat string `toml:"dateFormat"`
TimeFormat string `toml:"timeFormat"`
OutputFormat string `toml:"output_format"`
OutputStreamFormat string `toml:"output_stream_format"`
OutputMentionFormat string `toml:"output_mention_format"`
PMFormat string `toml:"pm_format"`
DateFormat string `toml:"date_format"`
TimeFormat string `toml:"time_format"`
}
// Colors holds the 'colors' section of the config file
type Colors struct {
Channels Channels `toml:"channels"`
Message Message `toml:"message"`
Feed Feed `toml:"feed"`
}
// Style holds basic style information
type Style struct {
Foreground string `toml:"foreground"`
Background string `toml:"background"`
@ -51,12 +61,14 @@ type Style struct { @@ -51,12 +61,14 @@ type Style struct {
Inverse bool `toml:"inverse"`
}
// Channels holds the style information for various elements of a channel
type Channels struct {
Basic Style `toml:"basic"`
Header Style `toml:"header"`
Unread Style `toml:"unread"`
}
// Message holds the style information for various elements of a message
type Message struct {
Body Style `toml:"body"`
Header Style `toml:"header"`
@ -72,13 +84,8 @@ type Message struct { @@ -72,13 +84,8 @@ type Message struct {
Code Style `toml:"code"`
}
// Feed holds the style information for various elements of the feed window
type Feed struct {
Basic Style `toml:"basic"`
Error Style `toml:"error"`
}
type Colors struct {
Channels Channels `toml:"channels"`
Message Message `toml:"message"`
Feed Feed `toml:"feed"`
}

Loading…
Cancel
Save