diff options
author | sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> | 2021-05-23 17:47:20 +0200 |
---|---|---|
committer | Sören Tempel <soeren+git@soeren-tempel.net> | 2021-05-23 21:55:37 +0200 |
commit | 6d1c4fca2b903cdf657e15c039656c0a30122c46 (patch) | |
tree | b37e8332f8a638bdc30a9f095fe6413ad7d60f30 | |
parent | ac0b98157d79e69c0f1422cb6236c7f978428dec (diff) |
Launch $SHELL by default if it is set
In an user environment (which saneterm would usually be executed in) $SHELL should point to the current user's login shell as per environ(7). On startup, check if the variable is set and use it to populate the default command to run if it is, otherwise fall back to `sh` like before. I believe this is the correct change even if it gives users (including me) more trouble since many login shells people will use (like fish) don't work well in saneterm, whereas /bin/sh usually will work fine.
-rw-r--r-- | saneterm/__main__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/saneterm/__main__.py b/saneterm/__main__.py index 95427f5..ee71ca3 100644 --- a/saneterm/__main__.py +++ b/saneterm/__main__.py @@ -1,12 +1,15 @@ import sys import argparse +import os from .terminal import * def get_parser(): + default_cmd = os.environ["SHELL"] if "SHELL" in os.environ else "sh" + parser = argparse.ArgumentParser() parser.add_argument('command', metavar='CMD', type=str, nargs='*', - default=['sh'], help='Command to execute') + default=[default_cmd], help='Command to execute (defaults to $SHELL)') return parser |