-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
plugins: Add ble.sh plugin #1884
Conversation
Sorry for the late reply! I have a question. Is
If so, there should be no problem unless some other plugins loaded after |
We touch |
Maybe you are using Bash 5.1? In Bash 5.1, Edit: For Bash 5.0 and lower, the attaching code of PROMPT_COMMAND="${1};${PROMPT_COMMAND}"
PROMPT_COMMAND=something # original value of PROMPT_COMMAND is lost |
Hmm, in any case, it seems to work just fine on my end. |
I think this might be a show stopper, but maybe not... We embed |
Could you describe what kind of problem you are thinking of? The above description is the behavior of |
@akinomyoga okay. thanks for the explanation. I'll try to find some time to test this locally soon. |
@cornfeedhobo @davidpfarrell gentle ping 😄 |
@cornfeedhobo if you have time today, I'll be glad if you could take a look at this PR |
@NoahGorny Okay, I tested this fresh today. This broke several things, like the history search plugins and most importantly the built-in pre-exec library. Without ble.sh:
With ble.sh:
Here is a sample of the error output upon loading a new shell:
It might be worth noting that I don't use the vi input method. I guess in summary I think this is so beta that we shouldn't include it. The install instructions require so many custom steps that it seems perfectly fine to have the user add a |
@cornfeedhobo Hi, I'm the author of If they are really unprocessed, there should be some problem in Another thing is that
I first need to clarify that
Could you explain in detail what this means?
I kind of agree with this. Essentially, this PR merely adds the single line Also, a more recommended way of setting |
@akinomyoga To be compatible with this PR, the install steps are something like: $ git clone --recursive https://github.com/akinomyoga/ble.sh.git
$ make -C ble.sh
$ mv ble.sh/out ~/.local/share/blesh |
@cornfeedhobo Oh, thank you for the clarification! You can actually simply run $ git clone --recursive https://github.com/akinomyoga/ble.sh.git
$ make -C ble.sh install The default install location is I have looked at the other plugins, but most of the plugins require additional installation by users. Is it a requirement for any bash-it plugin that it needs to be installed by a one-liner? |
@akinomyoga Nice to meet you :)
No, they don't have to be a one-liner, but afaik most of the plugins we have can be installed by the various package managers out there. I was simply emphasizing that is a custom install, and leaving it to the user seems like not much more of a stretch once they are running
I think some parts of my previous comment were mistaken. I was not speaking to the reasoning for your bindings. All I know is that I have a common plugin enabled that sets a readline setting, and this outputs a lot of error messages about it when starting the shell. I even disabled every plugin, completion, and alias, and disabled my theme. It was still very broken. Maybe the word "beta" was too loaded, and my apologies for that. However, my stance is still that we work hard to make plugins work smoothly with all the other combinations of plugins we support. This isn't 100% possible in all cases, but I feel like this plugin invites a lot more trouble than it's worth.
This sounds awesome, but bash-it is already tightly coupled to If you would like to chat about this further, or maybe setup a screen share, I'm available on IRC. @NoahGorny I'm not blocking this. This is a super cool project but I've cast my vote. I leave the decision to the rest of the team. |
@akinomyoga Last follow up that I'll leave here: I disabled every plugin, completion, alias, and my theme, as well as stripped down my bashrc to a bare minimum. I still got a lot of errors when loading ble.sh. I don't run a very customized distro (suse leap 15.2), so I imagine someone should be able to reproduce this. If you reach out over IRC, I'll do my best to assist in reproducing this. |
bash-preexec & ble.shI cannot still reproduce the As far as I remember, @cornfeedhobo's environment is bash-it (commit is unknown), ble.sh current master, bash-4.4, openSUSE 15.2. @cornfeedhobo tested with the minimal setup (I'm not sure the exact setup) of bash-it. @cornfeedhobo described preexec is broken with ble.sh, but I don't know the details on how it is broken. In my environment, everything seems to work correctly with the blesh plugin with the minimal bash-it setup: I tried with my openSUSE Tumbleweed setup in VirtualBox where the Bash version is 5.1. I'm using the latest commit of branch $ echo "$PROMPT_COMMAND"[RET]
__bp_precmd_invoke_cmd
__bp_interactive_mode If I define functions $ preexec() { echo $FUNCNAME; }[RET]
$ precmd() { echo $FUNCNAME; }[RET]
precmd
$ echo hello[RET]
preexec
hello
precmd Though, there is a slight behavior difference on empty lines. $ [RET]precmd I also tried the same setup in Fedora with different versions of Bash including bash-5.0, 4.4, and 4.3, but the behaviors were all the same. openSUSE /etc/inputrc & ble.sh (1) error messagesHere are other discussions that has been made on the IRC. The other issue of error messages reported by @cornfeedhobo has turned out to be the same issue as reported at akinomyoga/ble.sh#89. I have already reported it at openSUSE/aaa_base#84 openSUSE /etc/inputrc & ble.sh (2) [home] and [end]There was another issue by the interference of openSUSE
openSUSE /etc/inputrc & ble.sh (3) Slow initializationSince openSUSE source /path/to/ble.sh --noinputrc but this also disables the user settings in
|
Re: bash-preexec & ble.shI think I found an issue though I'm not sure if this is the issue @cornfeedhobo reported. This only happens when The problem is that # bashrc
source bash-preexec/bash-preexec.sh
preexec() { echo preexec; }
precmd() { echo precmd; }
_my_save_prompt_command=$PROMPT_COMMAND
PROMPT_COMMAND=_my_prompt_command
_my_prompt_command() {
local PROMPT_COMMAND=$_my_save_prompt_command
eval -- "$PROMPT_COMMAND"
: do something
}
I would later think whether I can work around this. |
@cornfeedhobo I added related fixes in ble.sh
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NoahGorny I leave several comments and suggestions in the PR.
I'm not good at the criterion for bash-it plugins, but this plugin seems to be essentially just source ble.sh
. I'm not sure if it's worth making this single command an independent plugin. Maybe one benefit of making this a plugin is that a user can look up blesh
from the list bash-it show plugins
and can enable/disable it by bash-it enable/disable plugin blesh
without directly editing .bashrc
.
In this plugin, the install location of ble.sh
is assumed to be a fixed location, ~/.local/share/blesh
. However, ble.sh
might be installed on a different place. For example, when one installed ble.sh
from AUR (Arch User Repository) using AUR helpers, the install location is /usr/share/blesh
. Shouldn't the install location be configurable by users? Or maybe an appropriate ble.sh
path should be automatically detected and selected? Or, maybe this plugin can automatically download and install ble.sh
on ~/.local/share/blesh
when it doesn't find ble.sh
in predefined locations.
@NoahGorny I just tested this again. It looks like this does play well with preexec now. I agree with @akinomyoga's comments above, and generally approve this PR now. If you want to make their requested changes, ping me for a re-review and I'll jump on it quickly. @akinomyoga Amazing work here, with great attention to detail. Thank you for hunting down these bugs and even helping me with my environment. I look forward to playing more with ble.sh. |
@cornfeedhobo Thank you for checking the updated
Thank you! If you find anything suspicious, please feel free to open issues! |
05f0672
to
6d8a072
Compare
see now @akinomyoga and @cornfeedhobo 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the naming convention of the global variables used by bash-it
, but I feel we can use some prefix for namespacing. /bash_it.sh
uses BASH_IT_*
and _bash_it_*
.
6d8a072
to
c360f0c
Compare
I will add a note about it in the next release- |
Description
Added a new plugin, which loads ble.sh
I ping @akinomyoga here, in case we should do more things in here except loading ble.sh plainly
Motivation and Context
ble.sh is a really interesting project, and seems like a nice addition as a Bash-it plugin 😄
How Has This Been Tested?
Locally
Types of changes
Checklist:
clean_files.txt
and formatted it usinglint_clean_files.sh
.