terrycojones / daudin

A Python command-line shell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What you have done is remarkable!

tahalukmanji opened this issue · comments

What you have here is amazing! Someday daudin can replace bash..., maybe rename it to pysh or something like that.

Hi @tahalukmanji - thanks for commenting. Glad you like it! If it may someday replace bash for you, that would be great. I just added a simple function to color my prompt (see https://github.com/terrycojones/daudin/blob/master/example-functions.py)

BTW, after I initially wrote it I contacted the guy who has the pysh project on PyPI and asked him if I could maybe have that name :-) He sent a nice reply and said he'd think about it if daudin got some users and urned into a real project. But he also said it could be confusing. Anyway, I like daudin (I have a position in a Zoology department, too), and it doesn't much matter. It's not very memorable or intuitive, I admit! I assume you saw the reasoning behind the name at the end of the README? Thanks again for the nice comment.

+1 This is great. Daudin is a distinct name but it would be nice to be more descriptive. What about psh. Given we import sh and we have sh & zsh as shells, why not psh?

Although ctrl-r will never replace the ease of use I get from zsh the python bash integration is wonderful. I use it with Python 3.8 and have started to build some little script files with it. This uses the results of a bash script that saves my CPU temp every 10 seconds to a file called .temps so its nice to use the walrus operator plus piping to nothing to avoid extra output

cat ~/.temps | [float(x) for x in _][-18:] | sum(_)/len(_) | (x := f'{_:0.2f}') |
cat ~/.temps | [float(x) for x in _][-180:] | sum(_)/len(_) | (y := f'{_:0.2f}') |
f'Average temperature for the last 30 / 3 minutes is {y} / {x}'

I assist with MITx 6.00.1x (over a million enrollments since 2012) so I'll mention it a few times and see if it ups your interest rate.

Hi @john9631 Thanks for all this - sorry for the slow reply, I've only just seen your comment. I looked for available names quite a bit before going for the left field daudin option (btw, psh is taken on PyPI). I mailed the author of pysh (which doesn't seem to be active) and he very nicely said he would consider giving up the name if daudin saw some adoption but also expressed concern that it might lead to confusion.

Thanks a lot re mentioning in the 6.00.1 course (I suppose that's the most famous course number ever, at least in the CS world), that would be great.

Although ctrl-r will never replace the ease of use I get from zsh the python bash integration is wonderful.

I normally use fish and miss the control-r reverse behavior of bash. But you get the control-r search in daudin (via readline). I'm wondering how zsh behaves - I've never used it. I'm not sure how easy it would be to replace the default behavior.

I use it with Python 3.8 and have started to build some little script files with it. This uses the results of a bash script that saves my CPU temp every 10 seconds to a file called .temps so its nice to use the walrus operator plus piping to nothing to avoid extra output

cat ~/.temps | [float(x) for x in _][-18:] | sum(_)/len(_) | (x := f'{_:0.2f}') |
cat ~/.temps | [float(x) for x in _][-180:] | sum(_)/len(_) | (y := f'{_:0.2f}') |
f'Average temperature for the last 30 / 3 minutes is {y} / {x}'

Cool :-)

I wasn't sure what the "to avoid extra output" meant, but now I get it. I guess you could start out like this too (and not see any output due to the assignment):

cat ~/.temps | temps = [float(x) for x in _]

or cat ~/.temps | temps = list(map(float, _)).

That's easier.

You should try zsh sometime. I went to it after an MIT TA persuaded me to try fish but I wasn't comfortable with its complete departure from Bash. Zsh give you a large amount of bash compatibility but with an interface you can't beat.

I would recommend using zprezto to make your choices simple.

For me, ctrl r in zsh maps to fzf so I get a fuzzy search of my zhistory:

ctrl r then search for htop

Thanks. Fish has (from my extremely limited knowledge of the state of the art) what seems like a ton of innovation, and despite its reverse search I don't think I could go back to bash. The predictive text it emits and the ease of using that feature is wonderful. But at the same time it feels to me like the change from the regular Bourne shell to a csh way back when - syntax changes meant to make life simpler or more friendly or something positive, that actually (for me) always felt somehow awkward and foreign. I guess it was just growing up (to the extent that I did that at all) with sh. Anyway, maybe zsh has that feature too - I will definitely take a look now, thanks. BTW, here's a 6 year old thread on the fish github repo with people (including me) asking for its search to be improved, with recommendations to use fzf (which I also use, but not enough) fish-shell/fish-shell#602