From 816d6eec2c04302b37a8a4c9032bcfe344d80d5a Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Wed, 11 Dec 2024 06:02:11 -0600 Subject: [PATCH] fix: deprecate direnv integration (#3464) * fix: deprecate direnv integration Fixes #2362 * fix: deprecate direnv integration Fixes #2362 --- docs/.vitepress/cli_commands.ts | 4 ++-- docs/cli/index.md | 2 -- docs/direnv.md | 33 ++++++++++++--------------------- man/man1/mise.1 | 3 --- mise.usage.kdl | 4 ++-- src/cli/direnv/activate.rs | 2 +- src/cli/direnv/mod.rs | 2 +- xtasks/fig/src/mise.ts | 14 -------------- 8 files changed, 18 insertions(+), 46 deletions(-) diff --git a/docs/.vitepress/cli_commands.ts b/docs/.vitepress/cli_commands.ts index 664ee868c3..0cba2f3123 100644 --- a/docs/.vitepress/cli_commands.ts +++ b/docs/.vitepress/cli_commands.ts @@ -80,7 +80,7 @@ export const commands: { [key: string]: Command } = { hide: false, }, direnv: { - hide: false, + hide: true, subcommands: { envrc: { hide: true, @@ -89,7 +89,7 @@ export const commands: { [key: string]: Command } = { hide: true, }, activate: { - hide: false, + hide: true, }, }, }, diff --git a/docs/cli/index.md b/docs/cli/index.md index 478d353318..3328ff5014 100644 --- a/docs/cli/index.md +++ b/docs/cli/index.md @@ -63,8 +63,6 @@ Answer yes to all confirmation prompts - [`mise config ls [--no-header] [-J --json]`](/cli/config/ls.md) - [`mise config set [-f --file ] [-t --type ] `](/cli/config/set.md) - [`mise deactivate`](/cli/deactivate.md) -- [`mise direnv `](/cli/direnv.md) -- [`mise direnv activate`](/cli/direnv/activate.md) - [`mise doctor`](/cli/doctor.md) - [`mise en [-s --shell ] [DIR]`](/cli/en.md) - [`mise env [FLAGS] [TOOL@VERSION]...`](/cli/env.md) diff --git a/docs/direnv.md b/docs/direnv.md index c07722510e..1aef158193 100644 --- a/docs/direnv.md +++ b/docs/direnv.md @@ -1,10 +1,19 @@ -# direnv +# direnv [direnv](https://direnv.net) and mise both manage environment variables based on directory. Because they both analyze the current environment variables before and after their respective "hook" commands are run, they can sometimes conflict with each other. +::: warning +The official stance is you should not use direnv with mise. Issues arising +from incompatibilities are not considered bugs. If mise has feature gaps +that direnv resolves, please open an issue so we can close those gaps. +While that's the official stance, the reality is mise and direnv usually +will work together just fine despite this. It's only more advanced use-cases +where problems arise. +::: + If you have an issue, it's likely to do with the ordering of PATH. This means it would really only be a problem if you were trying to manage the same tool with direnv and mise. For example, @@ -19,26 +28,8 @@ binaries to PATH. In these cases, mise will not interfere with direnv. ## mise inside of direnv (`use mise` in `.envrc`) ::: warning -Update 2024-01-21: after `use mise` has been out for a while, the general impression I have is that -while it technically functions fine, -not many people use it because the DX is notably worse than either switching to mise entirely -or using `mise activate` alongside direnv. - -The project direction of mise has changed since this was written and the new direction is for it -to be capable of replacing direnv completely for any use-case. This likely won't end up as a drop-in -replacement for direnv like with asdf, but solving the same problems in different ways. -See [environments](/environments.html) -for more details. - -I have had virtually no reports of problems with `use mise` in the year it has been out. -This could be because virtually no one is using it, or it has been surprisingly stable. I genuinely -don't know which. If you try it or use it regularly let me know. - -While I have no immediate plans or reasons to do this now, I could see this functionality being -the target of a future deprecation. Not because it's a maintenance burden, but because it just -hasn't -seemed like a particularly useful solution and it may help focus mise on the functionality that does -work for users. +`use mise` is deprecated and no longer supported. If `mise activate` does +not fit your use-case please post an issue. ::: If you do encounter issues with `mise activate`, or just want to use direnv in an alternate way, diff --git a/man/man1/mise.1 b/man/man1/mise.1 index 778cfeb1fe..63b9ac792e 100644 --- a/man/man1/mise.1 +++ b/man/man1/mise.1 @@ -74,9 +74,6 @@ Manage config files mise\-deactivate(1) Disable mise for current shell session .TP -mise\-direnv(1) -Output direnv function to use mise inside direnv -.TP mise\-doctor(1) Check mise installation for possible problems .TP diff --git a/mise.usage.kdl b/mise.usage.kdl index 7e69f58442..4be19a7201 100644 --- a/mise.usage.kdl +++ b/mise.usage.kdl @@ -311,7 +311,7 @@ This can be used to temporarily disable mise in a shell session." $ mise deactivate " } -cmd "direnv" help="Output direnv function to use mise inside direnv" { +cmd "direnv" hide=true help="Output direnv function to use mise inside direnv" { long_help r"Output direnv function to use mise inside direnv See https://mise.jdx.dev/direnv.html for more information @@ -321,7 +321,7 @@ you should run this command after installing new plugins. Otherwise direnv may not know to update environment variables when idiomatic file versions change." cmd "envrc" hide=true help="[internal] This is an internal command that writes an envrc file\nfor direnv to consume." cmd "exec" hide=true help="[internal] This is an internal command that writes an envrc file\nfor direnv to consume." - cmd "activate" help="Output direnv function to use mise inside direnv" { + cmd "activate" hide=true help="Output direnv function to use mise inside direnv" { long_help r"Output direnv function to use mise inside direnv See https://mise.jdx.dev/direnv.html for more information diff --git a/src/cli/direnv/activate.rs b/src/cli/direnv/activate.rs index 709234d6f5..d8c0252f7e 100644 --- a/src/cli/direnv/activate.rs +++ b/src/cli/direnv/activate.rs @@ -9,7 +9,7 @@ use indoc::indoc; /// you should run this command after installing new plugins. Otherwise /// direnv may not know to update environment variables when idiomatic file versions change. #[derive(Debug, clap::Args)] -#[clap(verbatim_doc_comment, after_long_help = AFTER_LONG_HELP)] +#[clap(hide=true, verbatim_doc_comment, after_long_help = AFTER_LONG_HELP)] pub struct DirenvActivate {} impl DirenvActivate { diff --git a/src/cli/direnv/mod.rs b/src/cli/direnv/mod.rs index 24ed781d8d..6c279ae053 100644 --- a/src/cli/direnv/mod.rs +++ b/src/cli/direnv/mod.rs @@ -15,7 +15,7 @@ mod exec; /// you should run this command after installing new plugins. Otherwise /// direnv may not know to update environment variables when idiomatic file versions change. #[derive(Debug, clap::Args)] -#[clap(verbatim_doc_comment)] +#[clap(hide = true, verbatim_doc_comment)] pub struct Direnv { #[clap(subcommand)] command: Option, diff --git a/xtasks/fig/src/mise.ts b/xtasks/fig/src/mise.ts index 9061168ae1..265992beea 100644 --- a/xtasks/fig/src/mise.ts +++ b/xtasks/fig/src/mise.ts @@ -822,20 +822,6 @@ const completionSpec: Fig.Spec = { ], "description": "Disable mise for current shell session" }, - { - "name": [ - "direnv" - ], - "description": "Output direnv function to use mise inside direnv", - "subcommands": [ - { - "name": [ - "activate" - ], - "description": "Output direnv function to use mise inside direnv" - } - ] - }, { "name": [ "doctor",