Skip to content

Commit

Permalink
apache#2817: Update to clap 4
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoday committed Oct 3, 2022
1 parent 76da624 commit 6580a98
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion integration-testing/Cargo.toml
Expand Up @@ -34,7 +34,7 @@ logging = ["tracing-subscriber"]
arrow = { path = "../arrow", default-features = false, features = ["test_utils", "ipc", "ipc_compression", "json"] }
arrow-flight = { path = "../arrow-flight", default-features = false }
async-trait = { version = "0.1.41", default-features = false }
clap = { version = "3", default-features = false, features = ["std", "derive"] }
clap = { version = "4", default-features = false, features = ["std", "derive"] }
futures = { version = "0.3", default-features = false }
hex = { version = "0.4", default-features = false, features = ["std"] }
prost = { version = "0.11", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions integration-testing/src/bin/arrow-json-integration-test.rs
Expand Up @@ -24,7 +24,7 @@ use arrow_integration_testing::{read_json_file, util::*};
use clap::Parser;
use std::fs::File;

#[derive(clap::ArgEnum, Debug, Clone)]
#[derive(clap::ValueEnum, Debug, Clone)]
#[clap(rename_all = "SCREAMING_SNAKE_CASE")]
enum Mode {
ArrowToJson,
Expand All @@ -41,7 +41,7 @@ struct Args {
arrow: String,
#[clap(short, long, help("Path to JSON file"))]
json: String,
#[clap(arg_enum, short, long, default_value_t = Mode::Validate, help="Mode of integration testing tool")]
#[clap(value_enum, short, long, default_value_t = Mode::Validate, help="Mode of integration testing tool")]
mode: Mode,
#[clap(short, long)]
verbose: bool,
Expand Down
4 changes: 2 additions & 2 deletions integration-testing/src/bin/flight-test-integration-client.rs
Expand Up @@ -20,7 +20,7 @@ use clap::Parser;
type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
type Result<T = (), E = Error> = std::result::Result<T, E>;

#[derive(clap::ArgEnum, Debug, Clone)]
#[derive(clap::ValueEnum, Debug, Clone)]
enum Scenario {
Middleware,
#[clap(name = "auth:basic_proto")]
Expand All @@ -40,7 +40,7 @@ struct Args {
help = "path to the descriptor file, only used when scenario is not provided. See https://arrow.apache.org/docs/format/Integration.html#json-test-data-format"
)]
path: Option<String>,
#[clap(long, arg_enum)]
#[clap(long, value_enum)]
scenario: Option<Scenario>,
}

Expand Down
4 changes: 2 additions & 2 deletions integration-testing/src/bin/flight-test-integration-server.rs
Expand Up @@ -21,7 +21,7 @@ use clap::Parser;
type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
type Result<T = (), E = Error> = std::result::Result<T, E>;

#[derive(clap::ArgEnum, Debug, Clone)]
#[derive(clap::ValueEnum, Debug, Clone)]
enum Scenario {
Middleware,
#[clap(name = "auth:basic_proto")]
Expand All @@ -33,7 +33,7 @@ enum Scenario {
struct Args {
#[clap(long)]
port: u16,
#[clap(long, arg_enum)]
#[clap(long, value_enum)]
scenario: Option<Scenario>,
}

Expand Down
2 changes: 1 addition & 1 deletion parquet/Cargo.toml
Expand Up @@ -43,7 +43,7 @@ num = { version = "0.4", default-features = false }
num-bigint = { version = "0.4", default-features = false }
arrow = { path = "../arrow", version = "24.0.0", optional = true, default-features = false, features = ["ipc"] }
base64 = { version = "0.13", default-features = false, features = ["std"], optional = true }
clap = { version = "3", default-features = false, features = ["std", "derive", "env"], optional = true }
clap = { version = "4", default-features = false, features = ["std", "derive", "env"], optional = true }
serde_json = { version = "1.0", default-features = false, features = ["std"], optional = true }
seq-macro = { version = "0.3", default-features = false }
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }
Expand Down
14 changes: 7 additions & 7 deletions parquet/src/bin/parquet-fromcsv.rs
Expand Up @@ -72,7 +72,7 @@ use std::{
};

use arrow::{csv::ReaderBuilder, datatypes::Schema, error::ArrowError};
use clap::{ArgEnum, Parser};
use clap::{ValueEnum, Parser};
use parquet::{
arrow::{parquet_to_arrow_schema, ArrowWriter},
basic::Compression,
Expand Down Expand Up @@ -153,7 +153,7 @@ struct Args {
output_file: PathBuf,
/// input file format
#[clap(
arg_enum,
value_enum,
short('f'),
long,
help("input file format"),
Expand All @@ -179,7 +179,7 @@ struct Args {
/// when input_format==TSV: 'TAB'
#[clap(short, long, help("field delimiter"))]
delimiter: Option<char>,
#[clap(arg_enum, short, long, help("record terminator"))]
#[clap(value_enum, short, long, help("record terminator"))]
record_terminator: Option<RecordTerminator>,
#[clap(short, long, help("escape charactor"))]
escape_char: Option<char>,
Expand All @@ -188,11 +188,11 @@ struct Args {
#[clap(short('D'), long, help("double quote"))]
double_quote: Option<bool>,
#[clap(short('c'), long, help("compression mode"), default_value_t=Compression::SNAPPY)]
#[clap(parse(try_from_str =compression_from_str))]
#[clap(value_parser =compression_from_str)]
parquet_compression: Compression,

#[clap(short, long, help("writer version"))]
#[clap(parse(try_from_str =writer_version_from_str))]
#[clap(value_parser =writer_version_from_str)]
writer_version: Option<WriterVersion>,
#[clap(short, long, help("max row group size"))]
max_row_group_size: Option<usize>,
Expand Down Expand Up @@ -263,13 +263,13 @@ impl Args {
}
}

#[derive(Debug, Clone, Copy, ArgEnum, PartialEq)]
#[derive(Debug, Clone, Copy, ValueEnum, PartialEq)]
enum CsvDialect {
Csv,
Tsv,
}

#[derive(Debug, Clone, Copy, ArgEnum, PartialEq)]
#[derive(Debug, Clone, Copy, ValueEnum, PartialEq)]
enum RecordTerminator {
LF,
Crlf,
Expand Down
2 changes: 1 addition & 1 deletion parquet/src/bin/parquet-rowcount.rs
Expand Up @@ -47,7 +47,7 @@ struct Args {
#[clap(
short,
long,
multiple_values(true),
number_of_values(1),
help("List of Parquet files to read from separated by space")
)]
file_paths: Vec<String>,
Expand Down

0 comments on commit 6580a98

Please sign in to comment.