Browse Source

2.0.1 (#256)

* typos, more examples and update year in license

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

* bump version

* update modules
master 2.0.1
Rasmus Lindroth 3 years ago committed by GitHub
parent
commit
33d7cd8cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      LICENSE
  2. 2
      README.md
  3. 43
      config.example.toml
  4. 10
      config/config.go
  5. 43
      config/default_config.go
  6. 4
      docs/man/tut.1
  7. 4
      docs/man/tut.1.md
  8. 63
      docs/man/tut.5
  9. 39
      docs/man/tut.5.md
  10. 2
      docs/man/tut.7
  11. 2
      docs/man/tut.7.md
  12. 2
      go.mod
  13. 4
      go.sum
  14. 4
      main.go

2
LICENSE

@ -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

2
README.md

@ -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 tut@fosstodon.org
```

43
config.example.toml

@ -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
@ -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
@ -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
@ -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"
@ -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=""
@ -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=""
@ -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"
@ -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,
@ -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=""
@ -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=""
@ -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.
#
@ -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"]
#

10
config/config.go

@ -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)

43
config/default_config.go

@ -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
@ -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
@ -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
@ -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"
@ -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=""
@ -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=""
@ -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"
@ -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,
@ -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=""
@ -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=""
@ -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.
#
@ -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"]
#

4
docs/man/tut.1

@ -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
@ -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].

4
docs/man/tut.1.md

@ -1,6 +1,6 @@
% tut(1) tut 2.0.0
% Rasmus Lindroth
% 2023-01-23
% 2023-01-24
# NAME
tut - a Mastodon TUI
@ -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 *tut@fosstodon.org*
# COMMANDS

63
docs/man/tut.5

@ -14,7 +14,7 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "tut" "5" "2023-01-23" "tut 2.0.0" ""
.TH "tut" "5" "2023-01-24" "tut 2.0.0" ""
.hy
.SH NAME
.PP
@ -86,7 +86,7 @@ See date-format for more info.
This displays relative dates instead for statuses that are one day or
older the output is 1y2m1d (1 year 2 months and 1 day)
.PP
The value is an integear
The value is an integer
.PD 0
.P
.PD
@ -102,7 +102,7 @@ The value is an integear
.PP
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.
Otherwise it will use the short or long format.
.PD 0
.P
.PD
@ -197,7 +197,7 @@ May ruin your reading experience.
\f[B]stick-to-top\f[R]=\f[I]false\f[R]
.SS show-boosted-user
.PP
Display the username of the person being boosted insted of the person
Display the username of the person being boosted instead of the person
that boosted.
.PD 0
.P
@ -234,7 +234,7 @@ So if you run :tag linux the title of the pane will be set to #linux
.PD
3 = No terminal title and no top bar in tut.
.PP
valid: 0, 1, 2, 4
valid: 0, 1, 2, 3
.PP
\f[B]terminal-title\f[R]=\f[I]0\f[R]
.SS redraw-ui
@ -337,7 +337,7 @@ notifications, lists, mentions, tag
.SS data
.PP
Used for the tag type, so here you set the tag.
If you have multiple you seperate them with a space.
If you have multiple you separate them with a space.
.PD 0
.P
.PD
@ -729,6 +729,44 @@ Enable notifications for new posts.
.SH OPEN-CUSTOM
.PP
This section is [open-custom] in your configuration file
.PP
Example:
.PP
[[open-custom.programs]]
.PD 0
.P
.PD
program = \[aq]chromium\[aq]
.PD 0
.P
.PD
terminal = false
.PD 0
.P
.PD
hint = \[dq][C]hrome\[dq]
.PD 0
.P
.PD
keys = [\[dq]c\[dq], \[dq]C\[dq]]
.PP
[[open-custom.programs]]
.PD 0
.P
.PD
program = \[aq]imv\[aq]
.PD 0
.P
.PD
terminal = false
.PD 0
.P
.PD
hint = \[dq][I]mv\[dq]
.PD 0
.P
.PD
keys = [\[dq]i\[dq], \[dq]I\[dq]]\[dq]
.SH OPEN-CUSTOM.PROGRAMS
.PP
This section is [[open-custom.programs]] in your configuration file.
@ -996,28 +1034,29 @@ The highlight color of for key hints
\f[B]controls-highlight\f[R]=\f[I]\[lq]\[lq]\f[R]
.SS autocomplete-background
.PP
The background color in dropdowns and autocompletions
The background color in drop-downs and autocompletions
.PD 0
.P
.PD
\f[B]autocomplete-background\f[R]=\f[I]\[lq]\[lq]\f[R]
.SS autocomplete-text
.PP
The text color in dropdowns at autocompletions
The text color in drop-downs at autocompletions
.PD 0
.P
.PD
\f[B]autocomplete-text\f[R]=\f[I]\[lq]\[lq]\f[R]
.SS autocomplete-selected-background
.PP
The background color for selected value in dropdowns and autocompletions
The background color for selected value in drop-downs and
autocompletions
.PD 0
.P
.PD
\f[B]autocomplete-selected-background\f[R]=\f[I]\[lq]\[lq]\f[R]
.SS autocomplete-selected-text
.PP
The text color for selected value in dropdowns and autocompletions
The text color for selected value in drop-downs and autocompletions
.PD 0
.P
.PD
@ -1062,7 +1101,7 @@ 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.
.PD 0
.P
.PD
@ -1088,7 +1127,7 @@ Examples:
\[dq]Yan[K]\[dq] = YanK with a highlighted K
.PP
The keys option lets you define what key that should be pressed.
This is limited to on character only and they are case sensetive.
This is limited to on character only and they are case sensitive.
.PD 0
.P
.PD

39
docs/man/tut.5.md

@ -1,6 +1,6 @@
% tut(5) tut 2.0.0
% Rasmus Lindroth
% 2023-01-23
% 2023-01-24
# NAME
tut - configuration for tut(1)
@ -44,12 +44,12 @@ Format for dates the same day. See date-format for more info.
## date-relative
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.
Value: 28 will display a relative date for toots that are between 1-28 days old. Otherwise it will use the short or long format.
**date-relative**=*-1*
## max-width
@ -110,7 +110,7 @@ Always jump to the newest post. May ruin your reading experience.
**stick-to-top**=*false*
## show-boosted-user
Display the username of the person being boosted insted of the person that boosted.
Display the username of the person being boosted instead of the person that boosted.
**show-boosted-user**=*false*
## commands-in-new-pane
@ -127,7 +127,7 @@ Set a default name for the timeline if the name is empty. So if you run :tag lin
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
**terminal-title**=*0*
@ -176,7 +176,7 @@ valid: home, direct, local, federated, bookmarks, saved, favorited, notification
**type**=*""*
## data
Used for the tag type, so here you set the tag. If you have multiple you seperate them with a space.
Used for the tag type, so here you set the tag. If you have multiple you separate them with a space.
**data**=*""*
## keys
@ -245,7 +245,6 @@ shortcut=\"r\"
type=\"list-split\"
data=\"column\"
shortcut=\"c\"
## type
The action you want to run.
@ -387,6 +386,20 @@ Enable notifications for new posts.
# OPEN-CUSTOM
This section is \[open-custom\] in your configuration file
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\"\]\"
# OPEN-CUSTOM.PROGRAMS
This section is \[\[open-custom.programs\]\] in your configuration file. You can have multiple of them.
@ -534,19 +547,19 @@ The highlight color of for key hints
**controls-highlight**=*""*
## autocomplete-background
The background color in dropdowns and autocompletions
The background color in drop-downs and autocompletions
**autocomplete-background**=*""*
## autocomplete-text
The text color in dropdowns at autocompletions
The text color in drop-downs at autocompletions
**autocomplete-text**=*""*
## autocomplete-selected-background
The background color for selected value in dropdowns and autocompletions
The background color for selected value in drop-downs and autocompletions
**autocomplete-selected-background**=*""*
## autocomplete-selected-text
The text color for selected value in dropdowns and autocompletions
The text color for selected value in drop-downs and autocompletions
**autocomplete-selected-text**=*""*
## button-color-one
@ -570,7 +583,7 @@ This section is \[input\] in your configuration file
In this section you set the keys to be used in tut.
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.
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 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.
Examples:
@ -579,7 +592,7 @@ Examples:
\"\[Enter\]\" = Enter where everything is highlighted
\"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.
The keys option lets you define what key that should be pressed. This is limited to on character only and they are case sensitive.
Example:
keys=\[\"j\",\"J\"\]

2
docs/man/tut.7

@ -14,7 +14,7 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "tut" "7" "2023-01-23" "tut 2.0.0" ""
.TH "tut" "7" "2023-01-24" "tut 2.0.0" ""
.hy
.SH NAME
.PP

2
docs/man/tut.7.md

@ -1,6 +1,6 @@
% tut(7) tut 2.0.0
% Rasmus Lindroth
% 2023-01-23
% 2023-01-24
# NAME
tut - keys and commands inside of tut(1)

2
go.mod

@ -15,7 +15,7 @@ require (
github.com/rivo/tview v0.0.0-20230104153304-892d1a2eb0da
github.com/rivo/uniseg v0.4.3
github.com/spf13/pflag v1.0.5
golang.org/x/exp v0.0.0-20230118134722-a68e582fa157
golang.org/x/exp v0.0.0-20230125214544-b3c2aaf6208d
golang.org/x/net v0.5.0
mvdan.cc/xurls/v2 v2.4.0
)

4
go.sum

@ -66,8 +66,8 @@ github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80/go.mod h1:iFy
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20230118134722-a68e582fa157 h1:fiNkyhJPUvxbRPbCqY/D9qdjmPzfHcpK3P4bM4gioSY=
golang.org/x/exp v0.0.0-20230118134722-a68e582fa157/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20230125214544-b3c2aaf6208d h1:9Bio0JlZpJ1P4NXsK5i8Rf2MclrRzMGzJWOIkhZ5Um8=
golang.org/x/exp v0.0.0-20230125214544-b3c2aaf6208d/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=

4
main.go

@ -10,9 +10,7 @@ import (
"github.com/rivo/tview"
)
const version = "2.0.0"
var tutViews []*ui.TutView
const version = "2.0.1"
func main() {
util.SetTerminalTitle("tut")

Loading…
Cancel
Save