This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new b9f17b030d Minor: Prevent empty datafusion-cli commands (#10219)
b9f17b030d is described below
commit b9f17b030d9fe69b3ef9ef86a7b9706449ab9399
Author: comphead <[email protected]>
AuthorDate: Thu Apr 25 03:33:19 2024 -0700
Minor: Prevent empty datafusion-cli commands (#10219)
* Prevent empty datafusion-cli commands
* err msg
* clippy
---
datafusion-cli/src/main.rs | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/datafusion-cli/src/main.rs b/datafusion-cli/src/main.rs
index 38537dbd92..6f71ccafb7 100644
--- a/datafusion-cli/src/main.rs
+++ b/datafusion-cli/src/main.rs
@@ -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,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]