Skip to content

Commit

Permalink
Merge pull request #2163 from jqnatividad/2160-lens-feature
Browse files Browse the repository at this point in the history
gate `prompt` command behind `prompt` feature
  • Loading branch information
jqnatividad committed Sep 22, 2024
2 parents a020a99 + fb04863 commit bd01a63
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-linux-glibc-231-musl-1124.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
addl-build-args: --features=apply,luau,fetch,foreach,self_update,polars,geocode,lens
addl-build-args: --features=apply,luau,fetch,foreach,self_update,polars,geocode,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau,polars
Expand All @@ -43,7 +43,7 @@ jobs:
target: x86_64-unknown-linux-musl
architecture: x86_64
musl-prep: true
addl-build-args: --features=apply,fetch,foreach,self_update,lens
addl-build-args: --features=apply,fetch,foreach,self_update,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-linux-glibc-231-musl-123.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
addl-build-args: --features=apply,luau,fetch,foreach,self_update,polars,geocode,lens
addl-build-args: --features=apply,luau,fetch,foreach,self_update,polars,geocode,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau,polars
Expand All @@ -43,7 +43,7 @@ jobs:
target: x86_64-unknown-linux-musl
architecture: x86_64
musl-prep: true
addl-build-args: --features=apply,fetch,foreach,self_update,polars,geocode,lens
addl-build-args: --features=apply,fetch,foreach,self_update,polars,geocode,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: polars
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-linux-qsvpy-glibc-231-musl-123.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
addl-build-args: --features=apply,luau,fetch,foreach,self_update,python,polars,geocode,lens
addl-build-args: --features=apply,luau,fetch,foreach,self_update,python,polars,geocode,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand All @@ -48,7 +48,7 @@ jobs:
target: x86_64-unknown-linux-musl
architecture: x86_64
musl-prep: true
addl-build-args: --features=apply,fetch,foreach,self_update,python,polars,geocode,lens
addl-build-args: --features=apply,fetch,foreach,self_update,python,polars,geocode,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-macOS-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
target: x86_64-apple-darwin
architecture: x86_64
use-cross: false
addl-build-args: --features=apply,fetch,foreach,self_update,luau,polars,to,geocode,lens
addl-build-args: --features=apply,fetch,foreach,self_update,luau,polars,to,geocode,lens,prompt
default-features: --no-default-features
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-nightly-glibc-231-musl-1124.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
addl-build-args: --features=apply,luau,fetch,foreach,nightly,self_update,polars,geocode,lens
addl-build-args: --features=apply,luau,fetch,foreach,nightly,self_update,polars,geocode,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand All @@ -43,7 +43,7 @@ jobs:
target: x86_64-unknown-linux-musl
architecture: x86_64
musl-prep: true
addl-build-args: --features=apply,fetch,foreach,nightly,self_update,polars,lens
addl-build-args: --features=apply,fetch,foreach,nightly,self_update,polars,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
addl-build-args: --features=apply,luau,fetch,foreach,nightly,self_update,geocode,polars,to,lens
addl-build-args: --features=apply,luau,fetch,foreach,nightly,self_update,geocode,polars,to,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau,polars
Expand All @@ -49,7 +49,7 @@ jobs:
os-name: windows
target: x86_64-pc-windows-msvc
architecture: x86_64
addl-build-args: --features=apply,luau,fetch,nightly,self_update,polars,geocode,to,lens
addl-build-args: --features=apply,luau,fetch,nightly,self_update,polars,geocode,to,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand All @@ -67,7 +67,7 @@ jobs:
os-name: macos
target: x86_64-apple-darwin
architecture: x86_64
addl-build-args: --features=apply,luau,fetch,foreach,nightly,to,self_update,polars,geocode,lens
addl-build-args: --features=apply,luau,fetch,foreach,nightly,to,self_update,polars,geocode,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish-portable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
target: x86_64-unknown-linux-gnu
architecture: x86_64
use-cross: false
addl-build-args: --features=apply,luau,fetch,foreach,self_update,geocode,polars,to,lens
addl-build-args: --features=apply,luau,fetch,foreach,self_update,geocode,polars,to,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau,polars
Expand All @@ -47,7 +47,7 @@ jobs:
architecture: x86_64
musl-prep: true
use-cross: false
addl-build-args: --features=apply,fetch,foreach,self_update
addl-build-args: --features=apply,fetch,foreach,self_update,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features:
Expand All @@ -67,7 +67,7 @@ jobs:
target: x86_64-pc-windows-msvc
architecture: x86_64
use-cross: false
addl-build-args: --features=apply,luau,fetch,self_update,geocode,polars,to,lens
addl-build-args: --features=apply,luau,fetch,self_update,geocode,polars,to,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand All @@ -87,7 +87,7 @@ jobs:
target: x86_64-pc-windows-gnu
architecture: x86_64
use-cross: false
addl-build-args: --features=apply,luau,fetch,self_update,geocode,polars,to,lens
addl-build-args: --features=apply,luau,fetch,self_update,geocode,polars,to,lens,prompt
default-features: --no-default-features
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
target: aarch64-unknown-linux-gnu
architecture: aarch64
use-cross: true
addl-build-args: --features=apply,fetch,foreach,self_update,lens
addl-build-args: --features=apply,fetch,foreach,self_update,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-qsvpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
addl-build-args: --features=apply,luau,fetch,foreach,self_update,geocode,polars,to,python,lens
addl-build-args: --features=apply,luau,fetch,foreach,self_update,geocode,polars,to,python,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand All @@ -49,7 +49,7 @@ jobs:
os-name: windows
target: x86_64-pc-windows-msvc
architecture: x86_64
addl-build-args: --features=apply,luau,fetch,self_update,polars,geocode,to,python,lens,foreach
addl-build-args: --features=apply,luau,fetch,self_update,polars,geocode,to,python,lens,foreach,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand All @@ -67,7 +67,7 @@ jobs:
os-name: macos
target: x86_64-apple-darwin
architecture: x86_64
addl-build-args: --features=apply,luau,fetch,foreach,to,self_update,polars,geocode,python,lens
addl-build-args: --features=apply,luau,fetch,foreach,to,self_update,polars,geocode,python,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
target: x86_64-unknown-linux-gnu
architecture: x86_64
use-cross: false
addl-build-args: --features=apply,luau,fetch,foreach,self_update,geocode,polars,to,lens
addl-build-args: --features=apply,luau,fetch,foreach,self_update,geocode,polars,to,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau,polars
Expand All @@ -50,7 +50,7 @@ jobs:
architecture: x86_64
musl-prep: true
use-cross: false
addl-build-args: --features=apply,fetch,foreach,self_update,lens
addl-build-args: --features=apply,fetch,foreach,self_update,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features:
Expand All @@ -70,7 +70,7 @@ jobs:
target: x86_64-pc-windows-msvc
architecture: x86_64
use-cross: false
addl-build-args: --features=apply,luau,fetch,self_update,geocode,polars,to,lens,foreach
addl-build-args: --features=apply,luau,fetch,self_update,geocode,polars,to,lens,foreach,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand All @@ -90,7 +90,7 @@ jobs:
target: x86_64-pc-windows-gnu
architecture: x86_64
use-cross: false
addl-build-args: --features=apply,luau,fetch,self_update,geocode,polars,to,lens,foreach
addl-build-args: --features=apply,luau,fetch,self_update,geocode,polars,to,lens,foreach,prompt
default-features: --no-default-features
addl-qsvlite-features:
addl-qsvdp-features: luau
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
target: aarch64-unknown-linux-gnu
architecture: aarch64
use-cross: true
addl-build-args: --features=apply,fetch,foreach,self_update,lens
addl-build-args: --features=apply,fetch,foreach,self_update,lens,prompt
default-features:
addl-qsvlite-features:
addl-qsvdp-features:
Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ reqwest = { version = "0.12", features = [
"stream",
"zstd",
], default-features = false }
rfd = "0.15"
rfd = { version = "0.15", optional = true }
rust_decimal = { version = "1.36", default-features = false }
ryu = "1"
sanitize-filename = { version = "0.5", optional = true }
Expand Down Expand Up @@ -327,6 +327,7 @@ distrib_features = [
"lens",
"luau",
"polars",
"prompt",
"python",
"to",
]
Expand Down Expand Up @@ -367,6 +368,7 @@ geocode = [
"simple-expand-tilde",
]
luau = ["mlua", "sanitize-filename", "simple-expand-tilde"]
prompt = ["rfd"]
python = ["pyo3"]
to = ["csvs_convert", "xlsxwriter"]
lens = ["arrow", "csvlens"]
Expand Down
1 change: 1 addition & 0 deletions docs/FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* `geocode` - enable `geocode` command.
* `luau` - enable `luau` command. Embeds a [Luau](https://luau-lang.org) interpreter into qsv. [Luau has type-checking, sandboxing, additional language operators, increased performance & other improvements](https://luau-lang.org/2022/11/04/luau-origins-and-evolution.html) over Lua.
* `polars` - enables all [Polars](https://pola.rs)-powered commands (currently, `joinp` and `sqlp`. Also enables polars mode in `count`). Note that Polars is a very powerful library, but it has a lot of dependencies that drastically increases both compile time and binary size.
* `prompt` - enable `prompt` command.
* `python` - enable `py` command. Note that qsv will look for the shared library for the Python version (Python 3.7 & above supported) it was compiled against & will abort on startup if the library is not found, even if you're NOT using the `py` command. Check [Python](#python) section for more info.
* `to` - enables the `to` command.
* `self_update` - enable self-update engine, checking GitHub for the latest release. Note that if you manually built qsv, `self-update` will only check for new releases.
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub mod luau;
pub mod partition;
#[cfg(any(feature = "feature_capable", feature = "lite"))]
pub mod pro;
#[cfg(any(feature = "feature_capable", feature = "lite"))]
#[cfg(feature = "prompt")]
pub mod prompt;
pub mod pseudo;
#[cfg(all(feature = "python", feature = "feature_capable"))]
Expand Down
11 changes: 8 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,14 @@ fn main() -> QsvExitCode {

enabled_commands.push_str(
" partition Partition CSV data based on a column value
pro Interact with the qsv pro API
prompt Open a file dialog to pick a file
pseudo Pseudonymise the values of a column\n",
pro Interact with the qsv pro API\n",
);

#[cfg(all(feature = "prompt", feature = "feature_capable"))]
enabled_commands.push_str(" prompt Open a file dialog to pick a file\n");

enabled_commands.push_str(" pseudo Pseudonymise the values of a column\n");

#[cfg(all(feature = "python", feature = "feature_capable"))]
enabled_commands.push_str(" py Evaluate a Python expression on CSV data\n");

Expand Down Expand Up @@ -377,6 +380,7 @@ enum Command {
Luau,
Partition,
Pro,
#[cfg(all(feature = "prompt", feature = "feature_capable"))]
Prompt,
Pseudo,
#[cfg(all(feature = "python", feature = "feature_capable"))]
Expand Down Expand Up @@ -472,6 +476,7 @@ impl Command {
Command::Luau => cmd::luau::run(argv),
Command::Partition => cmd::partition::run(argv),
Command::Pro => cmd::pro::run(argv),
#[cfg(all(feature = "prompt", feature = "feature_capable"))]
Command::Prompt => cmd::prompt::run(argv),
Command::Pseudo => cmd::pseudo::run(argv),
#[cfg(all(feature = "python", feature = "feature_capable"))]
Expand Down
3 changes: 0 additions & 3 deletions src/mainlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ macro_rules! command_list {
jsonl Convert newline-delimited JSON files to CSV
partition Partition CSV data based on a column value
pro Interact with the qsv pro API
prompt Open a file dialog to pick a file
pseudo Pseudonymise the values of a column
rename Rename the columns of CSV data efficiently
replace Replace patterns in CSV data
Expand Down Expand Up @@ -261,7 +260,6 @@ enum Command {
Jsonl,
Partition,
Pro,
Prompt,
Pseudo,
Rename,
Replace,
Expand Down Expand Up @@ -333,7 +331,6 @@ impl Command {
Command::Jsonl => cmd::jsonl::run(argv),
Command::Partition => cmd::partition::run(argv),
Command::Pro => cmd::pro::run(argv),
Command::Prompt => cmd::prompt::run(argv),
Command::Pseudo => cmd::pseudo::run(argv),
Command::Rename => cmd::rename::run(argv),
Command::Replace => cmd::replace::run(argv),
Expand Down
2 changes: 2 additions & 0 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ pub fn version() -> String {
Err(e) => enabled_features.push_str(&format!("Luau - cannot retrieve version: {e};")),
};
}
#[cfg(all(feature = "prompt", feature = "feature_capable"))]
enabled_features.push_str("prompt;");

#[cfg(all(feature = "python", not(feature = "lite")))]
{
Expand Down
1 change: 1 addition & 0 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ mod test_jsonl;
mod test_luau;
#[cfg(any(feature = "feature_capable", feature = "lite"))]
mod test_partition;
#[cfg(feature = "prompt")]
mod test_prompt;
mod test_pseudo;
#[cfg(feature = "python")]
Expand Down

0 comments on commit bd01a63

Please sign in to comment.