Skip to content

Commit 1d0a575

Browse files
authored
[Feat] allow users can generate image but not really run this command (#87)
1 parent d6e2742 commit 1d0a575

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cli/src/code.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ pub fn create_code(cli: &CLI, code_config: Code) -> anyhow::Result<Content> {
3939
.clone()
4040
.into_iter()
4141
.map(|command| {
42-
let output = execute_command(&command);
42+
let output = if cli.skip {
43+
"".to_string()
44+
} else {
45+
execute_command(&command)
46+
};
4347

4448
CommandLineContentBuilder::default()
4549
.full_command(&command)

cli/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,14 @@ struct CLI {
6464
#[arg(short, long)]
6565
output: String,
6666

67+
/// Executing a command and taking the output as the code snippet.
6768
#[arg(long, short, num_args=1..)]
6869
execute: Vec<String>,
6970

71+
/// Skip run the command to get output, just take the command as the input
72+
#[arg(long)]
73+
skip: bool,
74+
7075
/// You can set the range of the code snippet to display
7176
/// for example, display the 3rd to 5th:
7277
/// 3:5

0 commit comments

Comments
 (0)