jmatth / ezprompt

An easy to use webapp for creating simple bash prompts.
MIT License
343 stars 80 forks source link

FR/RFC: mksh support #7

Open mirabilos opened 8 years ago

mirabilos commented 8 years ago

Hi,

would you be interested in support for generating a PS1 for the other big Unix shell mksh from the same webapp? Shouldn’t be to difficult, and I convert GNU bash prompts to mksh syntax in IRC all the time…

Disclaimer / Full Disclosure: I’m also the mksh upstream developer

jmatth commented 8 years ago

Hey, sorry for not responding to this sooner. I've actually been meaning to refactor / add to this project for a while so sure, mksh support could be cool.

I've created a branch called mksh with basic mksh support that seems to work, though I haven't tested it extensively. The remaining work / known bugs are:

The rest of the prompt elements and color selection should work.

Something I'm not sure of is how to handle the shell version and shell release elements in mksh. In bash they appear as 4.2 and 4.2.42. The closest analog I could find was the $KSH_VERSION environment variable, but it doesn't follow the same major.minor.patch pattern. On my laptop it's @(#)MIRBSD KSH R51 2015/07/10. Any suggestions on what parts of this string it would make sense to display?

mirabilos commented 8 years ago

Josh Matthews dixit:

Hey, sorry for not responding to this sooner. I've actually been meaning to refactor / add to this project for a while so sure, mksh support could be cool.

OK, thanks.

I've created a branch called mksh with basic mksh support that seems to work, though I haven't tested it extensively. The remaining work / known bugs are:

OK, I’ll look at that when I get the time.

  • [ ] git status and error code aren't implemented.

Should be easy.

  • [ ] 12hr time w/ seconds shows AM/PM in mksh but not bash.

Isn’t it supposed to?

Something I'm not sure of is how to handle the shell version and shell release elements in mksh. In bash they appear as 4.2 and 4.2.42. The closest analog I could find was the $KSH_VERSION environment variable, but it doesn't follow the same major.minor.patch pattern. On my laptop it's @(#)MIRBSD KSH R51 2015/07/10. Any suggestions on what parts of this string it would make sense to display?

Well, the release number is the shell version, mostly, and the date could be used for shell release? I have no idea. I don’t subscribe to the concept that there should be multiple decimal dots in a number.

bye,

//mirabilos

„Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund, mksh auf jedem System zu installieren.“ -- XTaran auf der OpenRheinRuhr, ganz begeistert (EN: “[…]uhr.gz is a reason to install mksh on every system.”)