jmacdonald / amp

A complete text editor for your terminal.
https://amp.rs
Other
3.67k stars 105 forks source link

Allow overriding preferences in CLI arguments. #251

Open oldaccountdeadname opened 2 years ago

oldaccountdeadname commented 2 years ago

This patchset allows starting Amp as, for instance (amp --line_length_guide 72 /tmp/file). This is particularly useful in cases where an application creates a temporary file with no identifying extension and opens it in a user-configured editor (for instance, as mutt handles composing email).

There are substantial changes to the preferences module to support this change; see the earlier commits for everything that changed there. The weirdest thing about the changes is that my fork of yaml-rust is used to make the code a bit nicer (chyh1990/yaml-rust#179), but other than that I think it's all mostly standard stuff. Refactors could probably go a bit further, but I think it's okay as is.

Also note that in resolving merge conflicts, I just regenerated Cargo.lock, so some dependencies are on slightly later versions (no breaking changes afaict, though).