Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update rust crate clap to v4 #34

Merged
merged 3 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cargo-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions-rs/toolchain@v1
with:
toolchain: 1.63.0 # MSRV
toolchain: 1.64.0 # MSRV
profile: minimal
override: true

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ aws-config = "0.52.0"
aws-sdk-athena = "0.22.0"
bat = "0.22.1"
chrono = "0.4.23"
clap = { version = "3.2.23", features = ["derive"] }
clap = { version = "4.1.1", features = ["derive"] }
devtimer = "4.0.1"
env_logger = "0.10.0"
log = "0.4.17"
Expand Down
15 changes: 7 additions & 8 deletions src/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,40 @@ use crate::utils::pretty_print;
pub struct Apply {
/// Target path to render. If the target path is a directory,
/// the root folder must contains the index.sql file
#[clap(parse(from_os_str))]
pub file: PathBuf,

/// Change the context current working dir
#[clap(long, short, parse(from_os_str))]
#[arg(long, short)]
pub context: Option<PathBuf>,

/// Dry-run
#[clap(global = true, long, short)]
#[arg(global = true, long, short)]
pub dry_run: Option<bool>,

/// AWS Profile
/// Set this option via environment variable: export AWS_PROFILE=default
#[clap(global = true, long, short)]
#[arg(global = true, long, short)]
pub profile: Option<String>,

/// AWS Region
#[clap(global = true, long, short)]
#[arg(global = true, long, short)]
/// Set this option via environment variable: export AWS_DEFAULT_REGION=us-east-1
pub region: Option<String>,

/// AWS Athena Workgroup
/// Set this option via environment variable: export AWS_WORKGROUP=primary
#[clap(global = true, long, short)]
#[arg(global = true, long, short)]
pub workgroup: Option<String>,

/// AWS Athena output location
/// The location in Amazon S3 where your query results are stored
/// such as `s3://path/to/query/bucket/`
/// Set this option via environment variable: export AWS_OUTPUT_LOCATION=s3://bucket/
#[clap(global = true, long, short)]
#[arg(global = true, long, short)]
pub output_location: Option<String>,

/// No pretty print for SQL
#[clap(long)]
#[arg(long)]
pub no_pretty: Option<bool>,
}

Expand Down
7 changes: 3 additions & 4 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ use crate::utils::{get_current_working_dir, get_full_path_str, is_dir, pretty_pr
pub struct Build {
/// Target path to render. If the target path is a directory,
/// the root folder must contains the index.sql file
#[clap(parse(from_os_str))]
pub file: PathBuf,

/// Output path. The file will be overwritten if is already exists
#[clap(long, short, parse(from_os_str))]
#[arg(long, short)]
pub out: Option<PathBuf>,

/// Change the context current working dir
#[clap(long, short, parse(from_os_str))]
#[arg(long, short)]
pub context: Option<PathBuf>,

/// No pretty print for SQL
#[clap(long, short)]
#[arg(long, short)]
pub no_pretty: Option<bool>,
}

Expand Down
6 changes: 3 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use crate::{apply::Apply, build::Build};

/// Managing AWS Athena Schemas
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None)]
#[clap(arg_required_else_help(true))]
#[clap(color(clap::ColorChoice::Auto))]
pub struct Cli {
#[clap(subcommand)]
#[command(subcommand)]
pub cmd: Command,
}

Expand All @@ -22,5 +22,5 @@ pub enum Command {

// Parse the command line arguments
pub fn parse() -> Cli {
Cli::from_args()
Cli::parse()
}
4 changes: 1 addition & 3 deletions tests/test_cmd_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ fn build_missing_file() {

cmd.assert()
.failure()
.stderr(predicate::str::contains(
"The following required arguments were not provided",
))
.stderr(predicate::str::contains("were not provided"))
.stderr(predicate::str::contains("<FILE>"));
}

Expand Down