Skip to content

Commit 48aae19

Browse files
Merge pull request #131 from BenWiederhake/dev-remove-complete-featureflag
remove 'complete' feature flag, make it unconditional
2 parents fb6209a + 6e5f7b7 commit 48aae19

File tree

7 files changed

+7
-16
lines changed

7 files changed

+7
-16
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Install Rust toolchain
2121
uses: dtolnay/rust-toolchain@stable
2222
- uses: Swatinem/rust-cache@v2
23-
- run: cargo test --features complete --workspace
23+
- run: cargo test --workspace
2424

2525
rustfmt:
2626
name: Rustfmt
@@ -48,7 +48,7 @@ jobs:
4848
components: clippy
4949
- uses: Swatinem/rust-cache@v2
5050
- name: Clippy check
51-
run: cargo clippy --all-targets --features complete --workspace -- -D warnings
51+
run: cargo clippy --all-targets --workspace -- -D warnings
5252

5353
docs:
5454
name: Docs

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ readme = "README.md"
1111

1212
[dependencies]
1313
uutils-args-derive = { version = "0.1.0", path = "derive" }
14-
uutils-args-complete = { version = "0.1.0", path = "complete", optional = true }
14+
uutils-args-complete = { version = "0.1.0", path = "complete" }
1515
strsim = "0.11.1"
1616
lexopt = "0.3.0"
1717

1818
[features]
19-
parse-is-complete = ["complete"]
20-
complete = ["uutils-args-complete"]
19+
parse-is-complete = []
2120

2221
[workspace]
2322
members = ["derive", "complete"]

Justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
check:
22
cargo fmt --all
3-
cargo test --features complete
4-
cargo clippy --all-targets --features complete --workspace -- -D warnings
3+
cargo test
4+
cargo clippy --all-targets --workspace -- -D warnings
55
cargo doc

derive/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ pub fn arguments(input: TokenStream) -> TokenStream {
117117
#version_string
118118
}
119119

120-
#[cfg(feature = "complete")]
121120
fn complete() -> ::uutils_args_complete::Command<'static> {
122121
use ::uutils_args::Value;
123122
#complete_command
@@ -213,7 +212,6 @@ pub fn value(input: TokenStream) -> TokenStream {
213212
})
214213
}
215214

216-
#[cfg(feature = "complete")]
217215
fn value_hint() -> ::uutils_args_complete::ValueHint {
218216
let keys: [&str; #keys_len] = [#(#all_keys),*];
219217
::uutils_args_complete::ValueHint::Strings(

docs/guide/completions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The `[shell]` value here can be `fish`, `zsh`, `nu`, `sh`, `bash`, `csh`, `elvis
3939
4040
Additionally, the values `man` or `md` can be passed to generate man pages and markdown documentation (for `mdbook`).
4141

42-
If you do not want to hijack the [`Options::parse`](crate::Options::parse) function, you can instead enable the `complete` feature flag. This makes the `Options::complete` function available in addition to the [`Options::parse`](crate::Options::parse) function to generate a `String` with the completion.
42+
If you do not want to hijack the [`Options::parse`](crate::Options::parse) function, you can instead use the `Options::complete` function available in addition to the [`Options::parse`](crate::Options::parse) function to generate a `String` with the completion.
4343

4444
<div class="chapters">
4545

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ pub trait Arguments: Sized {
103103
Ok(())
104104
}
105105

106-
#[cfg(feature = "complete")]
107106
fn complete() -> uutils_args_complete::Command<'static>;
108107
}
109108

@@ -197,7 +196,6 @@ pub trait Options<Arg: Arguments>: Sized {
197196
}
198197
}
199198

200-
#[cfg(feature = "complete")]
201199
fn complete(shell: &str) -> String {
202200
uutils_args_complete::render(&Arg::complete(), shell)
203201
}

src/value.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use std::{
66
ffi::{OsStr, OsString},
77
path::PathBuf,
88
};
9-
#[cfg(feature = "complete")]
109
use uutils_args_complete::ValueHint;
1110

1211
pub type ValueResult<T> = Result<T, Box<dyn std::error::Error + Send + Sync + 'static>>;
@@ -54,7 +53,6 @@ impl std::fmt::Display for ValueError {
5453
pub trait Value: Sized {
5554
fn from_value(value: &OsStr) -> ValueResult<Self>;
5655

57-
#[cfg(feature = "complete")]
5856
fn value_hint() -> ValueHint {
5957
ValueHint::Unknown
6058
}
@@ -71,7 +69,6 @@ impl Value for PathBuf {
7169
Ok(PathBuf::from(value))
7270
}
7371

74-
#[cfg(feature = "complete")]
7572
fn value_hint() -> ValueHint {
7673
ValueHint::AnyPath
7774
}
@@ -98,7 +95,6 @@ where
9895
Ok(Some(T::from_value(value)?))
9996
}
10097

101-
#[cfg(feature = "complete")]
10298
fn value_hint() -> uutils_args_complete::ValueHint {
10399
T::value_hint()
104100
}

0 commit comments

Comments
 (0)