rust-cli/confy

Add a way to add comments and TOML sections to config files

sburris0 opened this issue · 4 comments

Comments can make config files more user-friendly by giving hints about possible values and where more info can be found.
When config files get large, sections are useful to break it up so that things are easier to find.

Thanks for making this, confy made my life much much easier today.

So, as far as I see, this crate uses the default toml implementation for rust: The toml crate. The toml crate is toml compliant, thus you can simply use comments in your config files:

# this is a comment
foo = "bar"

Right? Or am I missing something?

I am not an expert of the toml crate. But like @matthiasbeyer said, you can add comments manually, however I think that you cannot write a configuration with comments. I have never seen a way to manage comments in a config file programmatically.

So, as far as I see, this crate uses the default toml implementation for rust: The toml crate. The toml crate is toml compliant, thus you can simply use comments in your config files:

# this is a comment
foo = "bar"

Right? Or am I missing something?

I should have been more specific.
I want comments to be generated when the config file is created as most configuration files come pre-commented for clarity:


# make sxhkd reload its configuration files:
super + Escape
    pkill -USR1 -x sxhkd

#
# bspwm hotkeys
#

# quit/restart bspwm
super + alt + {q,r}
    bspc {quit,wm -r}

Cargo.toml has a note: # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html