Replies: 1 comment
-
hmm I stumbled on the prettier docs which use this example:
maybe that's good enough if we just change the generator to output |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to solve the problem that @joshbode was working on in #3956 and other PRs. Originally, I wanted to put logic around things like a list of staged files into an env var and keep the logic in the git hook generator. Currently, this hook (generated with
mise generate git-pre-commit
looks like this:however this doesn't work right if a file has spaces inside of it, and that's been a tricky problem to solve. (That was the intention behind #3956) So far, all of the ideas we've come up would greatly complicate the logic in the hook. I want to keep the logic in this hook simple so it's easy for people to modify to fit their needs. So far, I haven't found a way to do this that's simple or doesn't require modern bash unavailable on macos by default. Of course if someone knows how we could do this in bash that would be pretty simple, I'm all ears. You can see some of @joshbode's ideas on that PR but so far I don't think I've found one that I like.
Given that, I had a new idea that we could instead bring this into rust templates similar to what lefthook has:
I think it could look like this in a toml task definition:
where the template would be able to automatically insert quotes for paths with spaces like we have for
arg()
. The downside of this approach is that it would be limited to toml tasks since file tasks don't get run through our tera templates.Another thing I'd like to be able to do is somehow make it possible to make your project directory reflect only the staged state modifications—perhaps by running
git stash
or something to stash unstaged changes so you can have a pre-commit task that only sees the staged modifications. I'm not sure how to expose that though and it's tricky when we have multiple tasks potentially running in parallel (some may want only staged changes, some may not).Beta Was this translation helpful? Give feedback.
All reactions