mirror of
https://github.com/TheR1D/shell_gpt.git
synced 2026-07-03 14:10:18 +02:00
Configuration parameter to execute shell commands by default (#246)
This commit is contained in:
committed by
GitHub
parent
39b5b18079
commit
b8b87e6517
@@ -286,6 +286,8 @@ DEFAULT_MODEL=gpt-3.5-turbo
|
||||
DEFAULT_COLOR=magenta
|
||||
# Force use system role messages (not recommended).
|
||||
SYSTEM_ROLES=false
|
||||
# When in --shell mode, default to "Y" for no input.
|
||||
DEFAULT_EXECUTE_SHELL_CMD=false
|
||||
```
|
||||
Possible options for `DEFAULT_COLOR`: black, red, green, yellow, blue, magenta, cyan, white, bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white.
|
||||
|
||||
|
||||
+8
-1
@@ -175,7 +175,14 @@ def main(
|
||||
caching=cache,
|
||||
)
|
||||
|
||||
if shell and not stdin_passed and typer.confirm("Execute shell command?"):
|
||||
if (
|
||||
shell
|
||||
and not stdin_passed
|
||||
and typer.confirm(
|
||||
text="Execute shell command?",
|
||||
default=cfg.get("DEFAULT_EXECUTE_SHELL_CMD") == "true",
|
||||
)
|
||||
):
|
||||
run_command(full_completion)
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ DEFAULT_CONFIG = {
|
||||
"DEFAULT_COLOR": os.getenv("DEFAULT_COLOR", "magenta"),
|
||||
"ROLE_STORAGE_PATH": os.getenv("ROLE_STORAGE_PATH", str(ROLE_STORAGE_PATH)),
|
||||
"SYSTEM_ROLES": os.getenv("SYSTEM_ROLES", "false"),
|
||||
"DEFAULT_EXECUTE_SHELL_CMD": os.getenv("DEFAULT_EXECUTE_SHELL_CMD", "false"),
|
||||
# New features might add their own config variables here.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user