terrycojones / daudin

A Python command-line shell
MIT License
176 stars 9 forks source link

Two ideas? #12

Open v217 opened 4 years ago

v217 commented 4 years ago

Thank you for this great shell! Two ideas:

  1. Why not add the option to use --shell=False for running system commands without a shell e.g. subprocess.run(... shell=False) The scripts would be more portable, faster and less error prone and best of all you can forget about all the shell idiosyncrasies like shell escaping etc ... and error handling would also be much easier.
  2. If you have fish installed it's easy too add fish completions as an option for system commands and arguments (for example the clojure shell does this): https://github.com/dundalek/closh/blob/master/resources/completion/completion.fish Adding this as an option would make this shell as convenient as fish!
v217 commented 4 years ago

A workaround for the first point is daudin --shell '/usr/bin/env -S'

Oh and I noticed that terminating a subprocess eg sleep 1000 with Ctrl+c does work for --shell='bash -c' but does not work for --shell='sh -c', --shell='fish -c' and --shell='env -S' I think that's because bash parses the command and if there's only one command execve into the command and exits.

v217 commented 4 years ago

I also came across this article, which maybe is also useful for daudin: Zsh and Fish’s simple but clever trick for highlighting missing linefeeds

v217 commented 4 years ago

Sorry for this sudden agglomeration of ideas. I think in the long run it would be advantageous to factor out the non-interactive code. This would make it far easier to understand the code.

terrycojones commented 4 years ago

Hey @v217 - thanks for the comments, and definitely no need to apologize! :-) Right now I can't spend much time working on daudin but would like to. Anyway, I'm happy to chat and to think etc., and maybe will have time to work on small things (if I understand them!). Feel free to send pull requests if you want to & have time. Thanks for the nice comments. I don't think daudin is too far away from actually being usable, and I would like to try switching. But I use fish and would certainly miss the predictive text it adds to my command line based on previous commands.

BTW, daudin seems to sometimes screw up the terminal settings, which I need to dig into.