Skip to content

Commit

Permalink
2.0.1 (#256)
Browse files Browse the repository at this point in the history
* typos, more examples and update year in license

* show an error when the config can't be parsed

* bump version

* update modules
  • Loading branch information
RasmusLindroth authored Jan 26, 2023
1 parent 4b98d2f commit 33d7cd8
Show file tree
Hide file tree
Showing 14 changed files with 155 additions and 69 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2022 Rasmus Lindroth
Copyright (c) 2020-2023 Rasmus Lindroth

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ Flags:
-c --config <path> load config.toml from <path>
-d --config-dir <path> load all config from <path>
-u --user <name> login directly to user named <name>
If you want to login to multiple accounts seperate them with a space and use quotation marks. E.g. -u "acc_one acc_two"
If you want to login to multiple accounts separate them with a space and use quotation marks. E.g. -u "acc_one acc_two"
If two users are named the same. Use full name like [email protected]
```

Expand Down
43 changes: 29 additions & 14 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ date-tody-format="15:04"
# This displays relative dates instead for statuses that are one day or older
# the output is 1y2m1d (1 year 2 months and 1 day)
#
# The value is an integear
# The value is an integer
# -1 = don't use relative dates
# 0 = always use relative dates, except for dates < 1 day
# 1 - ∞ = number of days to use relative dates
#
# Value: 28 will display a relative date for toots that are between 1-28 days
# old. Otherwhise it will use the short or long format.
# old. Otherwise it will use the short or long format.
# default=-1
date-relative=-1

Expand Down Expand Up @@ -89,7 +89,7 @@ show-help=true
# default=false
stick-to-top=false

# Display the username of the person being boosted insted of the person that
# Display the username of the person being boosted instead of the person that
# boosted.
# default=false
show-boosted-user=false
Expand All @@ -107,7 +107,7 @@ dynamic-timeline-name=true
# 1 = Show title in terminal and top bar
# 2 = Only show terminal title, and no top bar in tut
# 3 = No terminal title and no top bar in tut.
# valid: 0, 1, 2, 4
# valid: 0, 1, 2, 3
# default=0
terminal-title=0

Expand All @@ -133,7 +133,7 @@ leader-timeout=1000
# Timelines adds panes of feeds. You can customize the number of feeds, what
# they should show and the key to activate them.

# Example:
# --- START OF EXAMPLE ---
# [[general.timelines]]
# name="home"
# type="home"
Expand All @@ -147,6 +147,7 @@ leader-timeout=1000
# closed=true
# on-creation-closed="new-pane"
# on-focus="focus-self"
# --- END OF EXAMPLE ---

# The name to display above the timeline
# default=""
Expand All @@ -159,7 +160,7 @@ leader-timeout=1000
# type=""

# Used for the tag type, so here you set the tag. If you have multiple you
# seperate them with a space.
# separate them with a space.
# default=""
# data=""

Expand Down Expand Up @@ -219,7 +220,7 @@ leader-timeout=1000
# list and the other content, e.g. proportions 1 3. See list-proportion above
# for more information.

# Example:
# --- START OF EXAMPLE ---
# [[general.leader-actions]]
# type="close-pane"
# shortcut="q"
Expand All @@ -233,7 +234,7 @@ leader-timeout=1000
# type="list-split"
# data="column"
# shortcut="c"
#
# --- END OF EXAMPLE ---

# The action you want to run.
# valid: blocking, boosts, clear-notifications, close-pane, compose, edit, favorited,
Expand Down Expand Up @@ -378,6 +379,20 @@ poll=false
posts=false

[open-custom]
# --- START OF EXAMPLE ---
# [[open-custom.programs]]
# program = 'chromium'
# terminal = false
# hint = "[C]hrome"
# keys = ["c", "C"]
#
# [[open-custom.programs]]
# program = 'imv'
# terminal = false
# hint = "[I]mv"
# keys = ["i", "I"]"
# --- END OF EXAMPLE ---

# [[open-custom.programs]]
# The program to open the file with.
# default=""
Expand Down Expand Up @@ -532,19 +547,19 @@ controls-text=""
# default=""
controls-highlight=""

# The background color in dropdowns and autocompletions
# The background color in drop-downs and autocompletions
# default=""
autocomplete-background=""

# The text color in dropdowns at autocompletions
# The text color in drop-downs at autocompletions
# default=""
autocomplete-text=""

# The background color for selected value in dropdowns and autocompletions
# The background color for selected value in drop-downs and autocompletions
# default=""
autocomplete-selected-background=""

# The text color for selected value in dropdowns and autocompletions
# The text color for selected value in drop-downs and autocompletions
# default=""
autocomplete-selected-text=""

Expand All @@ -571,7 +586,7 @@ timeline-name-text=""
#
# The hint option lets you set which part of the hint that will be highlighted
# in tut. E.g. [F]avorite results in a highlighted F and the rest of the text is
# displayed normaly.
# displayed normally.
# Some of the options can be in two states, like favorites, so there you can set
# the hint-alt option to something like Un[F]avorite.
#
Expand All @@ -582,7 +597,7 @@ timeline-name-text=""
# "Yan[K]" = YanK with a highlighted K
#
# The keys option lets you define what key that should be pressed. This is
# limited to on character only and they are case sensetive.
# limited to on character only and they are case sensitive.
# Example:
# keys=["j","J"]
#
Expand Down
10 changes: 8 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1381,9 +1381,15 @@ func parseConfig(filepath string, cnfPath string, cnfDir string) (Config, error)
return conf, err
}
var cnf ConfigTOML
toml.NewDecoder(f).Decode(&cnf)
d := toml.NewDecoder(f)
err = d.Decode(&cnf)

if err != nil {
log.Fatalln(err)
fmt.Print("Error while parsing your config:\n")
fmt.Println(err)
fmt.Println("\nThis message can be a bit unclear. If you don't understand the error you can open up an issue and I'll try to help you. Please post your config.toml in the issue.")
fmt.Println("https://github.com/RasmusLindroth/tut/issues")
os.Exit(1)
}
f.Close()
conf.General = parseGeneral(cnf.General)
Expand Down
43 changes: 29 additions & 14 deletions config/default_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ date-tody-format="15:04"
# This displays relative dates instead for statuses that are one day or older
# the output is 1y2m1d (1 year 2 months and 1 day)
#
# The value is an integear
# The value is an integer
# -1 = don't use relative dates
# 0 = always use relative dates, except for dates < 1 day
# 1 - ∞ = number of days to use relative dates
#
# Value: 28 will display a relative date for toots that are between 1-28 days
# old. Otherwhise it will use the short or long format.
# old. Otherwise it will use the short or long format.
# default=-1
date-relative=-1
Expand Down Expand Up @@ -91,7 +91,7 @@ show-help=true
# default=false
stick-to-top=false
# Display the username of the person being boosted insted of the person that
# Display the username of the person being boosted instead of the person that
# boosted.
# default=false
show-boosted-user=false
Expand All @@ -109,7 +109,7 @@ dynamic-timeline-name=true
# 1 = Show title in terminal and top bar
# 2 = Only show terminal title, and no top bar in tut
# 3 = No terminal title and no top bar in tut.
# valid: 0, 1, 2, 4
# valid: 0, 1, 2, 3
# default=0
terminal-title=0
Expand All @@ -135,7 +135,7 @@ leader-timeout=1000
# Timelines adds panes of feeds. You can customize the number of feeds, what
# they should show and the key to activate them.
# Example:
# --- START OF EXAMPLE ---
# [[general.timelines]]
# name="home"
# type="home"
Expand All @@ -149,6 +149,7 @@ leader-timeout=1000
# closed=true
# on-creation-closed="new-pane"
# on-focus="focus-self"
# --- END OF EXAMPLE ---
# The name to display above the timeline
# default=""
Expand All @@ -161,7 +162,7 @@ leader-timeout=1000
# type=""
# Used for the tag type, so here you set the tag. If you have multiple you
# seperate them with a space.
# separate them with a space.
# default=""
# data=""
Expand Down Expand Up @@ -221,7 +222,7 @@ leader-timeout=1000
# list and the other content, e.g. proportions 1 3. See list-proportion above
# for more information.
# Example:
# --- START OF EXAMPLE ---
# [[general.leader-actions]]
# type="close-pane"
# shortcut="q"
Expand All @@ -235,7 +236,7 @@ leader-timeout=1000
# type="list-split"
# data="column"
# shortcut="c"
#
# --- END OF EXAMPLE ---
# The action you want to run.
# valid: blocking, boosts, clear-notifications, close-pane, compose, edit, favorited,
Expand Down Expand Up @@ -380,6 +381,20 @@ poll=false
posts=false
[open-custom]
# --- START OF EXAMPLE ---
# [[open-custom.programs]]
# program = 'chromium'
# terminal = false
# hint = "[C]hrome"
# keys = ["c", "C"]
#
# [[open-custom.programs]]
# program = 'imv'
# terminal = false
# hint = "[I]mv"
# keys = ["i", "I"]"
# --- END OF EXAMPLE ---
# [[open-custom.programs]]
# The program to open the file with.
# default=""
Expand Down Expand Up @@ -534,19 +549,19 @@ controls-text=""
# default=""
controls-highlight=""
# The background color in dropdowns and autocompletions
# The background color in drop-downs and autocompletions
# default=""
autocomplete-background=""
# The text color in dropdowns at autocompletions
# The text color in drop-downs at autocompletions
# default=""
autocomplete-text=""
# The background color for selected value in dropdowns and autocompletions
# The background color for selected value in drop-downs and autocompletions
# default=""
autocomplete-selected-background=""
# The text color for selected value in dropdowns and autocompletions
# The text color for selected value in drop-downs and autocompletions
# default=""
autocomplete-selected-text=""
Expand All @@ -573,7 +588,7 @@ timeline-name-text=""
#
# The hint option lets you set which part of the hint that will be highlighted
# in tut. E.g. [F]avorite results in a highlighted F and the rest of the text is
# displayed normaly.
# displayed normally.
# Some of the options can be in two states, like favorites, so there you can set
# the hint-alt option to something like Un[F]avorite.
#
Expand All @@ -584,7 +599,7 @@ timeline-name-text=""
# "Yan[K]" = YanK with a highlighted K
#
# The keys option lets you define what key that should be pressed. This is
# limited to on character only and they are case sensetive.
# limited to on character only and they are case sensitive.
# Example:
# keys=["j","J"]
#
Expand Down
4 changes: 2 additions & 2 deletions docs/man/tut.1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "tut" "1" "2023-01-23" "tut 2.0.0" ""
.TH "tut" "1" "2023-01-24" "tut 2.0.0" ""
.hy
.SH NAME
.PP
Expand Down Expand Up @@ -46,7 +46,7 @@ Load all config from \f[I]<path>\f[R]
.TP
\f[B]-u\f[R], \f[B]--user\f[R] <name>
Login directly to user named \f[I]<name>\f[R].
If you want to login to multiple accounts seperate them with a space and
If you want to login to multiple accounts separate them with a space and
use quotation marks.
E.g.
-u \[lq]acc_one acc_two\[rq].
Expand Down
4 changes: 2 additions & 2 deletions docs/man/tut.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% tut(1) tut 2.0.0
% Rasmus Lindroth
% 2023-01-23
% 2023-01-24

# NAME
tut - a Mastodon TUI
Expand Down Expand Up @@ -31,7 +31,7 @@ To see keys and commands you can use inside of tut check tut(7).

**-u**, **\--user** \<name\>
: Login directly to user named *\<name\>*.
: If you want to login to multiple accounts seperate them with a space and use quotation marks. E.g. -u "acc_one acc_two".
: If you want to login to multiple accounts separate them with a space and use quotation marks. E.g. -u "acc_one acc_two".
: If two users are named the same, use full name like *[email protected]*

# COMMANDS
Expand Down
Loading

0 comments on commit 33d7cd8

Please sign in to comment.