mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-30 09:31:15 -03:00
Add '--init-command', '-C' to the command line switches.
In order to allow the execution of commands before dropping to an interactive prompt, a new switch, '-C' or '--init-command' has been added to those switches that we accept. The documentation has been updated correspondingly. The original code only supported a single command list to be executed, and this command list terminates the shell when it completes. To allow the new command list to preceed the original one, both have been wrapped in a new container class 'command_line_switches_t'. This is then passed around in place of the list of strings we used previously. I had considered moving the interactive, login and other command line switch states into this container, but doing so would change far more of the code, moving the structure to be available globally, and I wasn't confident of the impact. However, this might be a useful thing to do in the future. A new function, run_command_list, was lifted from the prior execution code, and re-used for both the initial command and the regular command execution.
This commit is contained in:
committed by
Kurtis Rader
parent
3b5fdc3fb0
commit
053d940d0a
@@ -13,6 +13,8 @@ The following options are available:
|
||||
|
||||
- `-c` or `--command=COMMANDS` evaluate the specified commands instead of reading from the commandline
|
||||
|
||||
- `-C` or `--init-command=COMMANDS` evaluate the specified commands after reading the configuration, before running the command specified by `-c` or reading interactive input
|
||||
|
||||
- `-d` or `--debug-level=DEBUG_LEVEL` specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
|
||||
|
||||
- `-i` or `--interactive` specify that fish is to run in interactive mode
|
||||
|
||||
Reference in New Issue
Block a user