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

refactor: Upgrade to clap v4 #13

Merged
merged 2 commits into from
Sep 28, 2022
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 .clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.54.0" # MSRV
msrv = "1.60.0" # MSRV
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ jobs:
- name: No-default features
run: cargo test --workspace --no-default-features
msrv:
name: "Check MSRV: 1.54.0"
name: "Check MSRV: 1.60.0"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.54.0 # MSRV
toolchain: 1.60.0 # MSRV
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.54.0 # MSRV
toolchain: 1.60.0 # MSRV
profile: minimal
override: true
components: clippy
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ jobs:
strategy:
matrix:
rust:
- 1.54.0 # MSRV
- 1.60.0 # MSRV
- stable
continue-on-error: ${{ matrix.rust != '1.54.0' }} # MSRV
continue-on-error: ${{ matrix.rust != '1.60.0' }} # MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ documentation = "https://docs.rs/codegenres"
readme = "README.md"
categories = ["development-tools", "text-processing"]
keywords = ["development", "codegen"]
edition = "2018"
edition = "2021"
rust-version = "1.60.0" # MSRV
include = [
"src/**/*",
"Cargo.toml",
Expand All @@ -32,6 +33,6 @@ default = ["clap"]

[dependencies]
difference = "2.0.0"
clap = { version = "3.0", features = ["derive"], optional = true }
clap = { version = "4.0.0", features = ["std", "derive"], optional = true }
normalize-line-endings = "0.3.0"
derive_more = "0.99.2"
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ use clap::Args;
/// ```rust
/// #[derive(clap::Parser)]
/// struct Args{
/// #[clap(short('i'), long, parse(from_os_str))]
/// #[arg(short('i'), long)]
/// input: std::path::PathBuf,
/// #[clap(flatten)]
/// #[command(flatten)]
/// codegen: codegenrs::CodeGenArgs,
/// }
/// ```
#[cfg(feature = "clap")]
#[derive(Debug, Args)]
pub struct CodeGenArgs {
#[clap(short('o'), long, parse(from_os_str))]
#[arg(short('o'), long)]
output: std::path::PathBuf,

#[clap(long)]
#[arg(long)]
check: bool,
}

Expand Down Expand Up @@ -101,18 +101,18 @@ pub fn write_str(
/// ```rust
/// #[derive(clap::Parser)]
/// struct Args{
/// #[clap(short('i'), long, parse(from_os_str))]
/// #[arg(short('i'), long)]
/// input: std::path::PathBuf,
/// #[clap(flatten)]
/// #[command(flatten)]
/// codegen: codegenrs::CodeGenArgs,
/// #[clap(flatten)]
/// #[command(flatten)]
/// rustfmt: codegenrs::RustfmtArgs,
/// }
/// ```
#[cfg(feature = "clap")]
#[derive(Debug, Args)]
pub struct RustfmtArgs {
#[clap(long, parse(from_os_str))]
#[arg(long)]
rustfmt_config: Option<std::path::PathBuf>,
}

Expand Down