Support for a config subcommand

There are some things that are required in every change which do not change, such as name, full name and email.

A command something like pijul config could be used to set these values globally/locally to the repo. Later, when doing a record, these values could be parsed from the configurations to auto fill the values. The configuration format could be in TOML

This removes some typos, errors which can occur while finalizing a change

Opinions are greatly welcomed

1 Like

Hi! Have you tried to configure these in .pijul/config.toml and ~/.config/pijul/config.toml (~/.pijulconfig on OSX)?

No I didn’t try that. There is no documentation about it whatsoever. Could you help me out how to write it

First, I totally understand your frustration, I get the same when I work with poorly documented stuff I didn’t write.

If you want to help with this, you can send changes to pijul/manual.

Aah! Yeah sure why not. But when I used the term write I meant to say how to write that config file

Plus, if you give me the reference of all the keys and values it can have, so I could write the docs

Alright, so my ~/.config/pijul/config.toml is exactly this:

[author]
name = "pmeunier"
full_name = "Pierre-Étienne Meunier"

My pijul/.pijul/config:

current_channel = "main"
default_remote = "nest"

[remotes]
nest = "pmeunier@nest.pijul.com:pijul/pijul"

The “current_channel” key is likely to disappear soon from that syntax.

2 Likes

Thanks. Are there any more keys/values. So, I tried to put the author details in pijul/.config/config that didn’t seem to have any effect. Although the ~/. config/pijul/config.toml did seem to do the job. It would be nice if we could add support to change it per repository based

Although it’s not a major issue right now

author can also have an email field.

Also, iirc it should be nest.url on the remotes but that may have changed.

Yeah! I did actually try that a few hours ago

Any reason not to also go for ~/.config on OSX? Looking around mine that’s what fish and hub and ripgrep use.

1 Like

This is very useful. Thanks for this!!!

Just seconding that macOS should also use ~/.config/pijul/, that’s the polite place to put command line tool configuration.

Pijul will first use the dirs-next crate, and if that fails, a bunch of default paths. I’m totally open to changing this way of doing things, but it may be more productive to firstdiscuss this with the authors of dirs-next, what do yous think?

I actually started working on config command yesterday night.

Regarding dirs-next, if someone can ask the maintainers and they say no, we can add a default in pijul ourselves.

dirs-next says it should put you in ~/Library/Application Support/pijul - which is a bit of a mouthful, but will I suppose avoid cluttering the home directory.

2 Likes

Here’s a dirs-next issue about this: https://github.com/xdg-rs/dirs/issues/45

If I understood correctly, the code has already been updated on Pijul’s side, so I should be able to use any of these on macOS, right?

  • ~/.pijulconfig
  • ~/.confog/pijul/config.toml
  • ~/Library/Application Support/pijul/config.toml

I’ve tried all of them but pager = "never" seems to do nothing :confused: I’m also trying to change my key location as follows:

[author]
key_path = "/some/path"

But Pijul still tries to read it from ~/Library/Application Support/pijul/secretkey.json. Does anyone have an idea about what I may be doing wrong?

The manual still doesn’t list the valid keys for the config file. You probably need to read the code to find what is supported.

Yep, I already did it. Both keys are supported, that’s why I suspect the file location is the wrong one. Can anyone confirm it?