Skip to content

Commit

Permalink
Minor: Prevent empty datafusion-cli commands (#10219)
Browse files Browse the repository at this point in the history
* Prevent empty datafusion-cli commands

* err msg

* clippy
  • Loading branch information
comphead authored Apr 25, 2024
1 parent b137346 commit b9f17b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion datafusion-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -83,7 +83,8 @@ struct Args {
short = 'c',
long,
multiple_values = true,
help = "Execute the given command string(s), then exit"
help = "Execute the given command string(s), then exit. Commands are expected to be non empty.",
validator(is_valid_command)
)]
command: Vec<String>,

@@ -285,6 +286,14 @@ fn is_valid_memory_pool_size(size: &str) -> Result<(), String> {
}
}

fn is_valid_command(command: &str) -> Result<(), String> {
if !command.is_empty() {
Ok(())
} else {
Err("-c flag expects only non empty commands".to_string())
}
}

#[derive(Debug, Clone, Copy)]
enum ByteUnit {
Byte,

0 comments on commit b9f17b0

Please sign in to comment.