Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving build dir to another directory #1

Closed
dlight opened this issue Jan 27, 2020 · 7 comments
Closed

Moving build dir to another directory #1

dlight opened this issue Jan 27, 2020 · 7 comments

Comments

@dlight
Copy link

dlight commented Jan 27, 2020

Here's some weird thing I do: I have a directory outside home where I put my target, node_modules etc, and I put symlinks on the project dirs. Those "shadow" directories are arranged in the same directory tree as the home directory. When I delete such build artifacts, I don't delete the directory that contains it (so I do not break the symlink). I do this to keep backups small.

I think your tool can help automate this workflow. I could pass a directory to it and it would move build dirs and set up symlinks. I may send a PR if you wish.

Anyway, thanks for this tool!

@tbillington
Copy link
Owner

That's really interesting! I'm a fan of symlinks myself. I'll have a think about it. It does seem somewhat of a deviation from the goal of this project but I do like the idea.

I hope this isn't too presumptuous but I'd encourage you to write a minimal version and put it up on Github :) Perhaps there will be more people interested in such a thing thank you think! I'd be happy to mention it in the readme of kondo.

For example I have thought about making a tool to "manage" symlinks before. To inform me of where I've made them, where they point etc.

I'm going to close this issue for now because it's not actionable but I appreciate that you took the time to make it :) !

@dlight
Copy link
Author

dlight commented Jan 28, 2020

Uhm, perhaps something that could fit kondo is to have a flag that execs a command for each build directory? Like fd -x or find -exec.

@tbillington
Copy link
Owner

@dlight Hmmm, that's actually a really good idea. Do you think this feature would cover that use case for you? #9

@dlight
Copy link
Author

dlight commented Jan 28, 2020

I think that printing and executing a command should be two separate flags.

Or alternatively, if you want to pipe a list of directories to another tool in a robust way it should be \0-separated, and not \n-separated (that's why find has a -print0 option), because directories can themselves contain \n in their names. But if you want to display this list in most situations, '\0' is obnoxious.

@dlight
Copy link
Author

dlight commented Jan 28, 2020

Also: with an execute flag you can pass many parameters to the program, such as: the project type (stack/rust/etc), the project root directory, and the build directory. To print a rich data like that you need a serialization format (many programs use json)

@tbillington
Copy link
Owner

because directories can themselves contain \n in their names.

😱

Ok good point, I will strongly consider the execute option, it makes a lot of sense. Do you think modeling it off find and fd is a good idea? Are there any other tools you use with an execute option that pass multiple fields as arguments?

@dlight
Copy link
Author

dlight commented Jan 28, 2020

Are there any other tools you use with an execute option that pass multiple fields as arguments?

Not that I remember, but find and fd pass the parameter as '{}', like this

fd -x echo a '{}' b
find -exec echo a '{}' b \;

fd alternatively lets you omit the '{}', implicitly inserting it at the end

fd -x echo a # same as fd -x echo a '{}'

Incidentally, this similar enough to println!() syntax that kondo could just use {kind}, {root} and {build} like this

kondo -x echo '{kind}', '{root}', '{build}'
# prints (for example) Cargo, /home/x/proj, /home/x/proj/target

Or maybe kondo could just not have {param}, and always pass it as the three first parameters (this is bad because adding fourth parameter would be backwards incompatible)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants