Skip to content

Commit

Permalink
fix: deprecate direnv integration (#3464)
Browse files Browse the repository at this point in the history
* fix: deprecate direnv integration

Fixes #2362

* fix: deprecate direnv integration

Fixes #2362
  • Loading branch information
jdx authored Dec 11, 2024
1 parent 6c28f1f commit 816d6ee
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 46 deletions.
4 changes: 2 additions & 2 deletions docs/.vitepress/cli_commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const commands: { [key: string]: Command } = {
hide: false,
},
direnv: {
hide: false,
hide: true,
subcommands: {
envrc: {
hide: true,
Expand All @@ -89,7 +89,7 @@ export const commands: { [key: string]: Command } = {
hide: true,
},
activate: {
hide: false,
hide: true,
},
},
},
Expand Down
2 changes: 0 additions & 2 deletions docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <FILE>] [-t --type <TYPE>] <KEY> <VALUE>`](/cli/config/set.md)
- [`mise deactivate`](/cli/deactivate.md)
- [`mise direnv <SUBCOMMAND>`](/cli/direnv.md)
- [`mise direnv activate`](/cli/direnv/activate.md)
- [`mise doctor`](/cli/doctor.md)
- [`mise en [-s --shell <SHELL>] [DIR]`](/cli/en.md)
- [`mise env [FLAGS] [TOOL@VERSION]...`](/cli/env.md)
Expand Down
33 changes: 12 additions & 21 deletions docs/direnv.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# direnv
# direnv <Badge type="warning" text="deprecated" />

[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,
Expand All @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions man/man1/mise.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions mise.usage.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/cli/direnv/activate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/direnv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Commands>,
Expand Down
14 changes: 0 additions & 14 deletions xtasks/fig/src/mise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 816d6ee

Please sign in to comment.