-
-
Notifications
You must be signed in to change notification settings - Fork 163
How Interactive Shells Work
andychu edited this page Mar 11, 2020
·
19 revisions
- Back to Interactive Shell (a page of ideas)
Let's figure out how interactive shells work! bash, zsh, fish, and Oil are significantly different. The goal is to figure out:
- What interactive features Oil should have. (Right now, it's mostly bash-like)
- What hooks/APIs it should have so that others can implement nice interactive experiences (like zsh plugins and
ble.sh
on top of bash)
Please add links or hand-written descriptions in the sections below, or talk to us on #oil-discuss
at https://oilshell.zulipchat.com/ (log in with Github)
- The prompt.
- In POSIX shell this is
$PS1
and$PS2
. - bash has extensions.
- Does a shell have to know how wide the prompt is to draw correctly? (note: this depends on unicode chars in the propmt)
- In POSIX shell this is
- Shell Autocompletion -- when you hit TAB, what happens
- Autosuggestions -- does it display suggestions on the prompt line automatically? That is, there is no prompting.
- Spell correct? zsh has this I think.
- History. What format is the history stored in?
- in bash it's a text file, which gives it an odd "two level store" behavior: see issue 324
note: feel free to split this into more wiki pages
- It uses GNU Readline. bash and readline are maintained together.
- TODO: What are the common plugins and what do they expect from the shell?
Features
- autosuggestions
TODO
- is there a "main loop" ?
- what does it expect from bash?
-
$LINES
,$COLUMNS
- it needs to trap
SIGWINCH
(todo: test this signal in Oil)
-
- how does it execute commands?
Oil is mostly bash-like now. I added a zsh-like completion interface that doesn't scroll every time you hit TAB, but it has some bugs, like #257.
- Search for
\x1b
to see all the escape codes Oil uses: https://github.com/oilshell/oil/blob/master/core/comp_ui.py