Hacker News new | past | comments | ask | show | jobs | submit login

You could negate the need for a --bash or --zsh flag by checking $SHELL:

  echo $SHELL | egrep -o '[a-z]+$'
It might also make sense to bundle everything under one file as well. While I'd normally advocate separating code into smaller and more manageable files, a single file shell script would be more convenient to install and would require less disk reads per every prompt call.

Looks good though. I'm definitely going to use this on my dev boxes.




I did try that on a previous tool Butler (https://github.com/michaeldfallen/butler) but I found that some shells don't actually set `$SHELL`.


Some don't, but $SHELL is generally accurate enough for Bash and Zsh.

You can also check the shell by checking the PID:

  ps -p $$
But then you need to do extra output parsing plus, obviously, ps each time you output $PS1. Which is going to be a little overkill for this project since it's only Zsh and Bash you're wanting to capture and you can always have fallback support for those flags when automatic detection fails.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: