Closed zach-is-my-name closed 1 year ago
I was thinking this as well - I was considering replacing the shell prompt (e.g. the >
or $
) with an indicator, maybe 🐠 for fun. Is that the kind of thing you're thinking of? Open to suggestions here.
I think it's a great idea. You can actually change my shell prompt from your go binary? That's beyond cool!
I think if they're going to run your wrapped shell you pretty much have license to manipulate anybody's prompt, I'd just want to preserve my current path inside it (mostly every prompt has this today right?).
I would want to control my prompt myself. Maybe you can offer the bash or zsh functions that the user can include in their brash prompt if they so choose.
The way I do it is the following:
function butterfish_shell {
[[ $BUTTERFISH_SHELL == "true" ]] && echo -ne " 🐠 "
}
local FIRST_LINE="...... \${K8S_CONTEXT} \$(butterfish_shell)"
PS1=${TERM_RESET}${PS1_START_MARK}${TERM_TITLE}${FIRST_LINE}${SECOND_LINE}${REGULAR_TEXT}${COMMAND_START_MARK}
Then start butterfish with BUTTERFISH_SHELL=true butterfish shell
If anything, a standard env var that butterfish sets itself would make my config more generic.
Ahh, @DavidGamba a standard env var is a great idea. This is a helpful discussion, I will play around and get something working.
Added related commits:
Let me summarize what I've done:
PS1
, meaning it will show up on the command line at each prompt. You can execute with -p ''
if you don't want anything appended, e.g. butterfish shell -p ''
.BUTTERFISH_SHELL
as an env var, so you can detect this in your .profile
(or whatever shell config). If BUTTERFISH_SHELL
is set then it will exit rather than wrapping the shell twice.Status
as a prompt, which will print out the current shell configuration, e.g. which models you're currently using.I will package this in a new release soon!
This is released in v0.0.31
, please update and let me know what you think!
...at least a quick way to query if you're in shell mode