SuperCuber / dotter

A dotfile manager and templater written in rust 🦀
The Unlicense
900 stars 48 forks source link

[FEATURE] Import command #146

Closed stephenh closed 1 year ago

stephenh commented 1 year ago

I'm currently using dotdrop for my dotfiles, but am tired of fighting the python/pip/virtualenv/whatever problem every time I set it up on a new machine.

I'm planning on migrating to dotter, but I've got a ~hundred or so files to add.

Afaict currently I'd have to add each file to the dotter global.toml file by hand. Which is fine, I'll probably get around to doing that, but fwiw if I could run:

dotter import vim ~/.vimrc
dotter import fish ~/.config/fish/functions 

And have those auto-added to the vim and fish sections of my dotter config file, I think that would save me a lot of time migrating over.

Thanks!

SuperCuber commented 1 year ago

I don't really see how you're saving time by running it that way...

To save some time with using the config file, you can use dotter watch -v in a separate terminal from your editor, then every time you save the config, the changes will be applied automatically.

Also, you could run dotter init to get a starter file with all files in a single package, pointing to nothing.

Let me know if this helped :)

stephenh commented 1 year ago

Thanks for the amazingly quick reply!

I had admittedly not ran dotter init in my current dotfiles repo yet, so I just did that and got this:

[default.files]
Enpass = ""
"README.md" = ""
bin = ""
"config.yaml" = ""
dotdrop = ""
"dotdrop.sh" = ""
dotfiles = ""
dotter = ""
env = ""
misc = ""
tools = ""
venv = ""

Which is cool but:

.vimrc = "~/.vimrc`

Granted, I like the idea of dotter's flexibility that the dotfiles location/name doesn't have to match the destination location/name, but for files that do match that convention, it would save a lot of time with that assumption.

I don't really see how you're saving time by running it that way...

:shrug: I dunno, I can go through a few "adding by hand" cycles and see how it goes, obviously it won't be terrible, but just fwiw when coming from dotdrop, I would essentially always run dotdrop import ... on whatever new file I wanted to track, and then only maybe ~10% of the time tweak the auto-generated config file entry.

SuperCuber commented 1 year ago

Good points. I remember wanting to do something like this, but I decided back then to not write to the user's configs except for init because i'm pretty sure the toml library doesn't preserve comments/order/formatting so it would be annoying having that reset for you. I wonder if there's a way to preserve that stuff easily...

For the directories, dotter will recurse into them for you and create a directory of symlinks at the target location. (unless you want each file in the directory to go to a different place of course, then you need to specify each one)

stephenh commented 1 year ago

Ah yeah, that makes sense if formatting wouldn't be preserved...

Granted, I have no emotional investment in the Rust/TOML/etc. solutions, but kinda makes me wonder if there is a more amenable-to-updates format to use than TOML... I come from the JS world where the likes of prettier, Jest snapshots, etc. means we've gotten used to that sort of thing/workflow.

Nonetheless, makes sense. Fwiw the lack of a robust auto-import did make me revisit the cruft that had accumulated in my dotfiles repo over the years, and I've deleted probably 2/3rds of it, so :shrug: it worked out!

Thanks!