BFH Terminal: custom user, host and working directory
BFH Terminal serves me well in creating visually appealing terminal representations (prompt, command, output). Thanks for creating & maintaining that module.
I am fine with using two global modes (prompt & console) but my use of this module is limited as follows:
- the current working path seems to be hard-coded to
~
[1]. Thus I can not represent anycd foo
command and it's impact on the path in the prompt - the
user@host
portion of the prompt is limited to the three predefineduser@host
combinations defined asroot
,student
andremote
[2]
Is there a way to pass the user, host and working directory as prompt parameters to the existing \setupLinuxPrompt
command? If so, I'd be thankful for an example. (I am happy to misuse/expand the existing prompt char
to squeeze-in the current working directory, if you show me how to do it with \setupLinuxPrompt
)
If \setupLinuxPrompt
does not have the required flexibility [3], I'd be thankful for a command e.g. \setupLinuxPromptUserHostPwd
that takes user, host and working directory as arguments to form the prompt. [5] My naive assumption is, that this can be done by expanding bfh-layout-terminal.cfg accordingly.
My use cases are:
- show students how to create, use and delete virtual python environments [4]
- general use of a Linux shell
- prompt, command & command output (already fulfilled today)
- change directory (requested with this issue)
- log in with various users at various hosts (requested with this issue)
Related issues:
Thank you very much for your time and consideration,
Benedict
[1] see https://gitlab.ti.bfh.ch/bfh-latex/bfh-ci/-/blob/master/tex/bfh-layout-terminal.cfg#L95
[2] see https://gitlab.ti.bfh.ch/bfh-latex/bfh-ci/-/blob/master/tex/bfh-layout-terminal.cfg#L136 and following
[3] my understanding is, that it takes only one argument to set up one of the three predefined prompts from [2]
[4]
ben@pax ~ $ mkdir tmp_venv
ben@pax ~ $ cd tmp_venv/
ben@pax ~/tmp_venv $ python -m venv .
ben@pax ~/tmp_venv $ source bin/activate
(tmp_venv) ben@pax ~/tmp_venv $ ls
bin include lib lib64 pyvenv.cfg
(tmp_venv) ben@pax ~/tmp_venv $ deactivate
ben@pax ~/tmp_venv $ cd ..
ben@pax ~ $
At the moment, I write the environment indicator (tmp_venv)
as part of the command which allows me to mimic the shells behavior with sufficient likeness for students to follow. I am more interested in representing cd
and it's impact on the prompt.
[5] If we go that route, it's probably best to add color
as option as well, for completeness sake.