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

Can't remove a binary installed to the relative path #184

Closed
MurzNN opened this issue Jan 17, 2024 · 5 comments · Fixed by #186
Closed

Can't remove a binary installed to the relative path #184

MurzNN opened this issue Jan 17, 2024 · 5 comments · Fixed by #186
Labels
good first issue Good for newcomers

Comments

@MurzNN
Copy link

MurzNN commented Jan 17, 2024

I installed a binary specifying only the binary name like this:

bin install https://github.com/mglaman/drupalorg-cli dcli

It put the binary to the current directory, instead of the default ~/.local/bin - that's probably okay.

But then I can't remove this binary using the bin remove command - it produces no errors, but the binary remains in the list of installed, here is the output:

$ bin 

 Path                                                   Version         URL                                                     Status
 /home/alexey_korepov/.local/bin/bin                    v0.17.2         github.com/marcosnils/bin                               OK
 /home/alexey_korepov/.local/bin/drupalorg.phar         0.5.1           https://github.com/mglaman/drupalorg-cli                OK
 dcli                                                   0.5.1           https://github.com/mglaman/drupalorg-cli                OK

$ bin remove dcli
$ bin remove /home/alexey_korepov/dcli

$ bin 

 Path                                                   Version         URL                                                     Status
 /home/alexey_korepov/.local/bin/bin                    v0.17.2         github.com/marcosnils/bin                               OK
 /home/alexey_korepov/.local/bin/drupalorg.phar         0.5.1           https://github.com/mglaman/drupalorg-cli                OK
 dcli                                                   0.5.1           https://github.com/mglaman/drupalorg-cli                OK
@MurzNN
Copy link
Author

MurzNN commented Jan 17, 2024

By the way, maybe treat a simple string (just a string without slashes) as a binary name, not as a path, so put it into the default directory, instead of the current one? And for the current directory recommend passing ./dcli. What do you think about this?

@marcosnils
Copy link
Owner

yes, this makes sense. Would you like to give this one a try? Happy to help shipping this.

@marcosnils marcosnils added the good first issue Good for newcomers label Jan 17, 2024
@MurzNN
Copy link
Author

MurzNN commented Jan 20, 2024

I'm not so familiar with Golang, but will try when will I get over the fear of trying :)

@MurzNN
Copy link
Author

MurzNN commented Jan 20, 2024

I think the detection of the path is it relative or just a name - should be done somewhere here:

if path, err = filepath.Abs(os.ExpandEnv(args[1])); err != nil {

The regexp check via ^[^/]+$ and if it's match - concat the config.Get().DefaultPath + / to the string start. Right?

@marcosnils
Copy link
Owner

👋 apologies the delay. just released a new version with the fix.

marcosnils added a commit that referenced this issue Jan 31, 2024
marcosnils added a commit that referenced this issue Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants