| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Do not run certain commands, except on specific operating systems, when
calling the global run command file. This allows users to avoid having
unaliases and unsets in their user-defined rc file (~/.dwvshrc).
Signed-off-by: Rory Dudley <rory@netc.lu>
|
|
|
|
|
| |
In the global /etc/dwvshrc file, alias grep so that it always displays
with color by default.
|
|
|
|
|
|
| |
The `which` command is not necessarily a builtin, however, it can
display shell aliases. This patch adds a line into dist/etc/dwvshrc,
which allows /usr/bin/which to detect our shell aliases, and print them.
|
|
|
|
|
| |
Instead of passing a hard-coded value for the prompt, use $PS1. The
default is '|> ', set in dist/etc/dwvshrc.
|
|
Use $PATH, instead of a hard-coded PATH from main(). This means that
there is no longer a need to pass around PATH to
repl()/recite()/path::refresh(), since path::refresh() can call env::var
directly.
Since the hard-coded paths were removed, there needs to be some way to
define $PATH. When running the debug build, dwvsh will look in
'dist/etc/dwvshrc' for the initial environment setup. For the release
target, dwvsh will look in '/etc/dwvshrc'. After the global rc file is
sourced, dwvsh will try to source ~/.dwvshrc if it exists, so users can
extend their environment without root access (assuming a release install).
Notes:
Throughout a lot of this program, we're calling `env!("HOME")`, in order
to get the user's home directory. Technically, this is not correct. The
env!() macro resolves environment variables during compile time, while
env::var() gets environment variables for the running process (i.e. the
shell). See https://users.rust-lang.org/t/env-vs-env-var/88119 for more
info. In the near future, this will need to be addressed. Might be worth
looking into what other shells do, though one idea I had was to invoke
'/usr/bin/id', grab the user's ID, and use it to grab the rest of the
info from /etc/passwd. This would be handled in an /etc/dwvlogin or
/etc/dwvprofile most likely.
|