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

feat: added "en" command #1697

Merged
merged 3 commits into from
Nov 28, 2024
Merged

feat: added "en" command #1697

merged 3 commits into from
Nov 28, 2024

Conversation

jdx
Copy link
Owner

@jdx jdx commented Feb 23, 2024

@booniepepper this isn't working right but I'm curious if you have any ideas.

The problem is that it will still load your rc files, so if you do something like `export PATH="/opt/homebrew/bin:$PATH" in your rc file that will make the mise tools lower priority than homebrew so it won't use mise tools if brew provides any.

One idea I had was running mise env when the shell starts but I'm not sure if it's possible to have zsh (for example) load a script like that.

Technically it does work though.

@jdx jdx linked an issue Feb 23, 2024 that may be closed by this pull request
Copy link

codacy-production bot commented Feb 23, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for bf15c1d1
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (bf15c1d) Report Missing Report Missing Report Missing
Head commit (adebad7) 16609 13870 83.51%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1697) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy will stop sending the deprecated coverage status from June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@jdx jdx marked this pull request as ready for review February 23, 2024 02:34
@jdx
Copy link
Owner Author

jdx commented Feb 23, 2024

I think I figured out a decent way forward. I just put some docs on how to disable the rc files with bash or zsh. I think that's better than trying to automatically do anything.

@jdx jdx force-pushed the en branch 4 times, most recently from 48cb851 to adebad7 Compare February 23, 2024 03:24
## `mise en [OPTIONS] [DIR]`

```text
[experimental] starts a new shell with the mise environment built from the current configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think $SHELL should be the default command launched

For the extra configuration like --shell SHELL... should this just support any command and be more like mise x -- <etc> but with a working directory set?

(The description of --cd uses "command" instead of "shell")

Asking because even with a shell, someone may want to be able to pass additional arguments like -r for restricted shell, or -l for login session, etc

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this just support any command and be more like mise x -- but with a working directory set?

well this is a very good point. I am going to need to ponder on this one a bit

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$SHELL is the default, but it has edge cases

@jdx jdx marked this pull request as draft February 27, 2024 01:17
@jdx jdx force-pushed the main branch 2 times, most recently from fad123b to d13511e Compare April 23, 2024 19:21
@jdx jdx closed this May 14, 2024
@jdx jdx deleted the en branch May 27, 2024 02:19
@jdx jdx restored the en branch November 28, 2024 04:20
@jdx jdx reopened this Nov 28, 2024
@jdx jdx marked this pull request as ready for review November 28, 2024 04:26
@jdx jdx changed the title added "en" command feat: added "en" command Nov 28, 2024
@jdx jdx force-pushed the en branch 2 times, most recently from 3769c93 to 206f514 Compare November 28, 2024 11:46
@jdx
Copy link
Owner Author

jdx commented Nov 28, 2024

I think my issue is actually limited to fish (what I use) and how fish_user_paths work. It's a universal variable that always gets loaded. Skipping rc files isn't really a solution because that means you get no prompt or anything. I handled fish uniquely by running it with fish -C "fish_add_path -gm ..." which causes the mise paths to get loaded after fish gets loaded. That should fix the issue I had. I don't think this would be a problem with bash or zsh since in those shells users should be putting that stuff into ~/.bash_profile and ~/.zprofile I think.

Well, it would be an issue if it was in ~/.zshenv or whatever the bash equivalent to that is but I think in that case I can just tell users not to do that since that shouldn't be there anyways.

Anyhow, this might be just a fish thing mostly but I fixed fish.

@jdx jdx force-pushed the en branch 2 times, most recently from 0085704 to 59bcdad Compare November 28, 2024 19:03
@jdx jdx merged commit 23ee779 into main Nov 28, 2024
21 checks passed
@jdx jdx deleted the en branch November 28, 2024 19:16
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

Successfully merging this pull request may close these issues.

mise en
2 participants