@@ -18,9 +18,6 @@ pub(crate) enum Error {
1818 #[ error( transparent) ]
1919 Client ( #[ from] influxdb3_client:: Error ) ,
2020
21- #[ error( transparent) ]
22- Query ( #[ from] QueryError ) ,
23-
2421 #[ error( "invlid UTF8 received from server: {0}" ) ]
2522 Utf8 ( #[ from] Utf8Error ) ,
2623
@@ -42,7 +39,7 @@ pub(crate) enum Error {
4239pub ( crate ) type Result < T > = std:: result:: Result < T , Error > ;
4340
4441#[ derive( Debug , Parser ) ]
45- #[ clap( visible_alias = "q" , trailing_var_arg = true ) ]
42+ #[ clap( visible_alias = "q" ) ]
4643pub struct Config {
4744 /// Common InfluxDB 3 Core config
4845 #[ clap( flatten) ]
@@ -73,7 +70,7 @@ pub struct Config {
7370 file_path : Option < String > ,
7471
7572 /// The query string to execute
76- query : Option < Vec < String > > ,
73+ query : Option < String > ,
7774}
7875
7976#[ derive( Debug , ValueEnum , Clone ) ]
@@ -94,7 +91,7 @@ pub(crate) async fn command(config: Config) -> Result<()> {
9491 }
9592
9693 let query = if let Some ( query) = config. query {
97- parse_query ( query) ?
94+ query
9895 } else if let Some ( file_path) = config. file_path {
9996 fs:: read_to_string ( file_path) ?
10097 } else {
@@ -145,27 +142,3 @@ pub(crate) async fn command(config: Config) -> Result<()> {
145142
146143 Ok ( ( ) )
147144}
148-
149- #[ derive( Debug , thiserror:: Error ) ]
150- pub ( crate ) enum QueryError {
151- #[ error( "no query provided" ) ]
152- NoQuery ,
153-
154- #[ error(
155- "ensure that a single query string is provided as the final \
156- argument, enclosed in quotes"
157- ) ]
158- MoreThanOne ,
159- }
160-
161- /// Parse the user-inputted query string
162- fn parse_query ( mut input : Vec < String > ) -> Result < String > {
163- if input. is_empty ( ) {
164- Err ( QueryError :: NoQuery ) ?
165- }
166- if input. len ( ) > 1 {
167- Err ( QueryError :: MoreThanOne ) ?
168- } else {
169- Ok ( input. remove ( 0 ) )
170- }
171- }
0 commit comments