Xithrius / twitch-tui

Twitch chat in the terminal.
https://xithrius.github.io/twitch-tui/
Apache License 2.0
437 stars 32 forks source link

Configurator generates potentially "malformed" config.toml #448

Closed Dark-Sol closed 1 year ago

Dark-Sol commented 1 year ago

Describe the bug: The config.toml file that is generated by the configurator does not look like the example-config.toml file on here. None of the helpful hints that explain what each setting is and or what they could be set to are in that config.toml file.

To Reproduce:

  1. Install a clean instance of Twitch-tui.
  2. Run twt at the command prompt.
  3. Enter all the data at the prompts given by the configurator.
  4. Twitch-tui should open and be usable due to the user entering their OAuth token.
  5. Close Twitch-tui.
  6. A config.toml file should be in %appdata%/roming/twt/ (I've posted what that config.toml file looks like below, while removing all the personal info.)

System:

username = ""
channel = ""
server = "[irc.chat.twitch.tv](http://irc.chat.twitch.tv/)"
token = ""

[terminal]
delay = 30
maximum_messages = 500
verbose = false
first_state = "Dashboard"

[storage]
channels = false
mentions = false

[filters]
enabled = false
reversed = false

[frontend]
show_datetimes = true
datetime_format = "%a %b %e %T %Y"
username_shown = true
palette = "pastel"
title_shown = true
margin = 0
badges = false
theme = "dark"
username_highlight = true
state_tabs = false
cursor_shape = "user"
blinking_cursor = false
inverted_scrolling = false
show_scroll_offset = false
twitch_emotes = false
betterttv_emotes = false
seventv_emotes = false
frankerfacez_emotes = false
favorite_channels = []
recent_channel_count = 5
border_type = "plain"
right_align_usernames = false
Xithrius commented 1 year ago

I'm unsure if it's possible to generate a config file with the comments, as it doesn't pull from default-config.toml in the repository. Instead, it just takes al the default values of each attribute and writes them to a file.

I'll do some more research to see if I can get the comments to be outputted. If not, the generator will have to be rewritten (shouldn't be too difficult).

Dark-Sol commented 1 year ago

I think you could leave it as is, if you want. You'd just need to write in the documentation that the behavior seen is what a user should expect if they don't copy default-config.toml from the repository. Or when building Twitch-tui, have it pull default-config.toml and then rename it to config.toml, if that's possible?

Xithrius commented 1 year ago

Doing the second isn't possible during the build, but during runtime I could have a request fetch get the raw data from default-config.toml and write it to config.toml.

I'll have to consider the first, because requesting would probably better for the user in the end.

Dark-Sol commented 1 year ago

Maybe make it conditional so that it's only when it runs the configurator that it does the request fetch?

Xithrius commented 1 year ago

Perhaps

Xithrius commented 1 year ago

Alright, if you say no to the interactive config generation, then the config will generate with comments. I wasn't able to figure out how to combine interactive config generation with the args that are provided with comments, so this'll do for now.

It'll be in the next release.

Fixed in 3c111e52b74150b7511b963e533819182bc6e0e1