Compare commits
2 Commits
2eba530895
...
66801b5d07
| Author | SHA1 | Date | |
|---|---|---|---|
|
66801b5d07
|
|||
|
f2de196e22
|
@@ -507,12 +507,14 @@ open_link() {
|
||||
|
||||
guard_operation() {
|
||||
if [[ -t 1 ]]; then
|
||||
ans="$(confirm "${1:-Are you sure you want to continue?}")"
|
||||
if [[ -z "$AUTO_CONFIRM" ]]; then
|
||||
ans="$(confirm "${1:-Are you sure you want to continue?}")"
|
||||
|
||||
if [[ "$ans" == 0 ]]; then
|
||||
error "Operation aborted!" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$ans" == 0 ]]; then
|
||||
error "Operation aborted!" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -657,13 +659,13 @@ guard_path() {
|
||||
path="$(_to_real_path "$1")"
|
||||
confirmation_prompt="$2"
|
||||
|
||||
if [[ ! "$path" == "$(pwd)"* ]]; then
|
||||
ans="$(confirm "$confirmation_prompt")"
|
||||
if [[ ! "$path" == "$(pwd)"* && -z "$AUTO_CONFIRM" ]]; then
|
||||
ans="$(confirm "$confirmation_prompt")"
|
||||
|
||||
if [[ "$ans" == 0 ]]; then
|
||||
error "Operation aborted!" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$ans" == 0 ]]; then
|
||||
error "Operation aborted!" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ loki --info | grep 'config_dir' | awk '{print $2}'
|
||||
- [Files and Directory Related Variables](#files-and-directory-related-variables)
|
||||
- [Agent Related Variables](#agent-related-variables)
|
||||
- [Logging Related Variables](#logging-related-variables)
|
||||
- [Miscellaneous Variables](#miscellaneous-variables)
|
||||
<!--toc:end-->
|
||||
|
||||
---
|
||||
@@ -104,3 +105,8 @@ The following variables can be used to change the log level of Loki or the locat
|
||||
|
||||
**Pro-Tip:** You can always tail the Loki logs using the `--tail-logs` flag. If you need to disable color output, you
|
||||
can also pass the `--disable-log-colors` flag as well.
|
||||
|
||||
## Miscellaneous Variables
|
||||
| Environment Variable | Description | Default Value |
|
||||
|----------------------|--------------------------------------------------------------------------------------------------|---------------|
|
||||
| `AUTO_CONFIRM` | Bypass all `guard_*` checks in the bash prompt helpers; useful for agent composition and routing | |
|
||||
@@ -207,7 +207,9 @@ open_link https://www.google.com
|
||||
```
|
||||
|
||||
### guard_operation
|
||||
Prompt for permission to run an operation
|
||||
Prompt for permission to run an operation.
|
||||
|
||||
Can be disabled by setting the environment variable `AUTO_CONFIRM`.
|
||||
|
||||
**Example:**
|
||||
```bash
|
||||
@@ -216,7 +218,9 @@ _run_sql
|
||||
```
|
||||
|
||||
### guard_path
|
||||
Prompt for permission to perform path operations
|
||||
Prompt for permission to perform path operations.
|
||||
|
||||
Can be disabled by setting the environment variable `AUTO_CONFIRM`.
|
||||
|
||||
**Example:***
|
||||
```bash
|
||||
|
||||
@@ -204,6 +204,7 @@ impl Agent {
|
||||
|
||||
pub fn init_agent_variables(
|
||||
agent_variables: &[AgentVariable],
|
||||
pre_set_variables: Option<&AgentVariables>,
|
||||
no_interaction: bool,
|
||||
) -> Result<AgentVariables> {
|
||||
let mut output = IndexMap::new();
|
||||
@@ -214,6 +215,10 @@ impl Agent {
|
||||
let mut unset_variables = vec![];
|
||||
for agent_variable in agent_variables {
|
||||
let key = agent_variable.name.clone();
|
||||
if let Some(value) = pre_set_variables.and_then(|v| v.get(&key)) {
|
||||
output.insert(key, value.clone());
|
||||
continue;
|
||||
}
|
||||
if let Some(value) = agent_variable.default.clone() {
|
||||
output.insert(key, value);
|
||||
continue;
|
||||
|
||||
+10
-4
@@ -2607,8 +2607,11 @@ impl Config {
|
||||
None => return Ok(()),
|
||||
};
|
||||
if !agent.defined_variables().is_empty() && agent.shared_variables().is_empty() {
|
||||
let new_variables =
|
||||
Agent::init_agent_variables(agent.defined_variables(), self.info_flag)?;
|
||||
let new_variables = Agent::init_agent_variables(
|
||||
agent.defined_variables(),
|
||||
self.agent_variables.as_ref(),
|
||||
self.info_flag,
|
||||
)?;
|
||||
agent.set_shared_variables(new_variables);
|
||||
}
|
||||
if !self.info_flag {
|
||||
@@ -2626,8 +2629,11 @@ impl Config {
|
||||
let shared_variables = agent.shared_variables().clone();
|
||||
let session_variables =
|
||||
if !agent.defined_variables().is_empty() && shared_variables.is_empty() {
|
||||
let new_variables =
|
||||
Agent::init_agent_variables(agent.defined_variables(), self.info_flag)?;
|
||||
let new_variables = Agent::init_agent_variables(
|
||||
agent.defined_variables(),
|
||||
self.agent_variables.as_ref(),
|
||||
self.info_flag,
|
||||
)?;
|
||||
agent.set_shared_variables(new_variables.clone());
|
||||
new_variables
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user