-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
600 additions
and
49 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Hooks | ||
|
||
You can have mise automatically execute scripts when it runs. The configuration goes into `mise.toml`. | ||
|
||
## CD hook | ||
|
||
This hook is run anytimes the directory is changed. | ||
|
||
```toml | ||
[hooks] | ||
cd = "echo 'I changed directories'" | ||
``` | ||
|
||
## Enter hook | ||
|
||
This hook is run when the project is entered. Changing directories while in the project will not trigger this hook again. | ||
|
||
```toml | ||
[hooks] | ||
enter = "echo 'I entered the project'" | ||
``` | ||
|
||
## Leave hook (not yet implemented) | ||
|
||
This hook is run when the project is left. Changing directories while in the project will not trigger this hook. | ||
|
||
```toml | ||
[hooks] | ||
leave = "echo 'I left the project'" | ||
``` | ||
|
||
## Preinstall/postinstall hook | ||
|
||
These hooks are run before tools are installed. Unlike other hooks, these hooks do not require `mise activate`. | ||
|
||
```toml | ||
[hooks] | ||
preinstall = "echo 'I am about to install tools'" | ||
postinstall = "echo 'I just installed tools'" | ||
``` | ||
|
||
## Watch files hook | ||
|
||
While using `mise activate` you can have mise watch files for changes and execute a script when a file changes. | ||
|
||
```bash | ||
[[watch_files]] | ||
patterns = ["src/**/*.rs"] | ||
script = "cargo fmt" | ||
``` | ||
|
||
This hook will have the following environment variables set: | ||
|
||
- `MISE_WATCH_FILES_MODIFIED`: A colon-separated list of the files that have been modified. Colons are escaped with a backslash. | ||
|
||
## Hook execution | ||
|
||
Hooks are executed with the following environment variables set: | ||
|
||
- `MISE_ORIGINAL_CWD`: The directory that the user is in. | ||
- `MISE_PROJECT_DIR`: The root directory of the project. | ||
- `MISE_PREVIOUS_DIR`: The directory that the user was in before the directory change (only if a directory change occurred). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
#cat <<EOF >mise.toml | ||
#[tools] | ||
#dummy = 'latest' | ||
#[hooks] | ||
#enter = 'echo ENTER' | ||
#leave = 'echo LEAVE' | ||
#cd = 'echo CD' | ||
#preinstall = 'echo PREINSTALL' | ||
#postinstall = 'echo POSTINSTALL' | ||
#EOF | ||
# | ||
#assert "mise i" "PREINSTALL\nPOSTINSTALL\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.