Skip to content

Commit

Permalink
Merge pull request #2289 from jqnatividad/2285-ui-feature
Browse files Browse the repository at this point in the history
create `ui` feature to make it easier to make a headless build of qsv
  • Loading branch information
jqnatividad authored Nov 15, 2024
2 parents d087965 + d6083e1 commit 28062f4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ panic = "abort"

[dependencies]
ahash = "0.8"
arboard = { version = "3.4.1", default-features = false }
arboard = { version = "3.4.1", default-features = false, optional = true }
atoi_simd = "0.16"
base62 = { version = "2.0", optional = true }
bytemuck = { version = "1.19", features = [
Expand Down Expand Up @@ -347,7 +347,7 @@ distrib_features = [
"python",
"to",
]
all_features = ["distrib_features", "self_update"]
all_features = ["distrib_features", "self_update", "ui"]
apply = [
"base62",
"censor",
Expand All @@ -363,6 +363,7 @@ apply = [
"titlecase",
"whatlang",
]
clipboard = ["arboard"]
fetch = [
"cached",
"console",
Expand Down Expand Up @@ -391,6 +392,7 @@ to = ["csvs_convert"]
lens = ["csvlens"]
lite = []
datapusher_plus = ["self_update"]
ui = ["clipboard", "prompt", "lens"]
feature_capable = []
nightly = [
"crc32fast/nightly",
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub mod applydp;
pub mod behead;
#[cfg(any(feature = "feature_capable", feature = "lite"))]
pub mod cat;
#[cfg(any(feature = "feature_capable", feature = "lite"))]
#[cfg(feature = "clipboard")]
pub mod clipboard;
pub mod count;
pub mod datefmt;
Expand Down
14 changes: 11 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,15 @@ fn main() -> QsvExitCode {

enabled_commands.push_str(
" behead Drop header from CSV file
cat Concatenate by row or column
clipboard Provide input from clipboard or output to clipboard
count Count records
cat Concatenate by row or column\n",
);

#[cfg(all(feature = "clipboard", feature = "feature_capable"))]
enabled_commands
.push_str(" clipboard Provide input from clipboard or output to clipboard\n");

enabled_commands.push_str(
" count Count records
datefmt Format date/datetime strings
dedup Remove redundant rows
describegpt Infer extended metadata using a LLM
Expand Down Expand Up @@ -329,6 +335,7 @@ enum Command {
Apply,
Behead,
Cat,
#[cfg(all(feature = "clipboard", feature = "feature_capable"))]
Clipboard,
Count,
Datefmt,
Expand Down Expand Up @@ -422,6 +429,7 @@ impl Command {
#[cfg(all(feature = "apply", feature = "feature_capable"))]
Command::Apply => cmd::apply::run(argv),
Command::Cat => cmd::cat::run(argv),
#[cfg(all(feature = "clipboard", feature = "feature_capable"))]
Command::Clipboard => cmd::clipboard::run(argv),
Command::Count => cmd::count::run(argv),
Command::Datefmt => cmd::datefmt::run(argv),
Expand Down
5 changes: 1 addition & 4 deletions src/mainlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
static COMMAND_LIST: &str = r#"
behead Drop header from CSV file
cat Concatenate by row or column
clipboard Provide input from clipboard or output to clipboard
count Count records
datefmt Format date/datetime columns
dedup Remove redundant rows
Expand Down Expand Up @@ -146,7 +145,7 @@ fn main() -> QsvExitCode {
None => {
werr!(
"qsvlite is a suite of CSV command line utilities.\n\nPlease choose one of the \
following commands:\n{COMMAND_LIST}\n\n{SPONSOR_MESSAGE}",
following 49 commands:\n{COMMAND_LIST}\n\n{SPONSOR_MESSAGE}",
);

// if no command is specified, auto-check for updates 10% of the time
Expand Down Expand Up @@ -225,7 +224,6 @@ fn main() -> QsvExitCode {
enum Command {
Behead,
Cat,
Clipboard,
Count,
Datefmt,
Dedup,
Expand Down Expand Up @@ -292,7 +290,6 @@ impl Command {
match self {
Command::Behead => cmd::behead::run(argv),
Command::Cat => cmd::cat::run(argv),
Command::Clipboard => cmd::clipboard::run(argv),
Command::Count => cmd::count::run(argv),
Command::Datefmt => cmd::datefmt::run(argv),
Command::Dedup => cmd::dedup::run(argv),
Expand Down
5 changes: 3 additions & 2 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ mod test_behead;
#[cfg(any(feature = "feature_capable", feature = "lite"))]
mod test_cat;
#[cfg(all(
any(feature = "feature_capable", feature = "lite"),
any(target_os = "windows", target_os = "macos")
any(feature = "feature_capable"),
any(target_os = "windows", target_os = "macos"),
feature = "clipboard",
))]
mod test_clipboard;
mod test_combos;
Expand Down

0 comments on commit 28062f4

Please sign in to comment.