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

Fix: Shell completions are broken when login shell is different than currently active shell #1884 #1969

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

imransolanki
Copy link
Contributor

@imransolanki imransolanki commented Aug 21, 2024

What type of PR is this?

  • bug

What this PR does / why we need it:

This is a fix to bug- Shell completions are broken when login shell is different than currently active shell #1884

  • Using $0 as an env variable instead of SHELL as $0 gives the currently active shell

Which issue(s) this PR fixes:

Fixes the bug- Shell completions are broken when a login shell is different than currently active shell #1884

Special notes for your reviewer:

Testing

Updated the existing test case.

Release Notes

Fixed https://github.com/urfave/cli/issues/1884

@imransolanki imransolanki requested a review from a team as a code owner August 21, 2024 09:30
@imransolanki imransolanki changed the title fix: /bin/zsh env variable to retrieve current active shell fix: Use $0 env variable to retrieve current active shell Aug 21, 2024
@imransolanki imransolanki changed the title fix: Use $0 env variable to retrieve current active shell Fix: Use $0 env variable to retrieve current active shell Aug 21, 2024
@bartekpacia
Copy link
Member

Hey, can you tell us more about how it works?

@imransolanki
Copy link
Contributor Author

Hey, can you tell us more about how it works?

The code retrieves env var $0 which gives us the active shell.
Earlier the code was retrieving the current shell using $SHELL which denotes the login shell.
In the best-case scenario $SHELL and $0 are equal

Example of $0 in action
image

Copy link
Member

@bartekpacia bartekpacia left a comment

Choose a reason for hiding this comment

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

I see. Thank you, this change LGTM. I'm holding off with merge for other maintainers to take a look.

Copy link
Member

@asahasrabuddhe asahasrabuddhe left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@asahasrabuddhe
Copy link
Member

FWIW, we should look into backporting this to v2 as well. What do you think?

@bartekpacia
Copy link
Member

I think this is worth backporting, yeah

Copy link
Contributor

@dearchap dearchap left a comment

Choose a reason for hiding this comment

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

@imransolanki Thanks !!!!

@dearchap dearchap merged commit 5386081 into urfave:main Aug 22, 2024
13 checks passed
@imransolanki imransolanki changed the title Fix: Use $0 env variable to retrieve current active shell Fix: Shell completions are broken when login shell is different than currently active shell #1884 Aug 22, 2024
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.

4 participants