Skip to content
Merged
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bqtools"
version = "0.5.5"
version = "0.5.6"
edition = "2021"
license = "MIT"
authors = ["Noam Teyssier <noam.teyssier@arcinstitute.org>"]
Expand Down Expand Up @@ -31,6 +31,8 @@ rand = "0.10.0"
regex = "1.12.2"
sassy = { version = "0.2.1", optional = true }
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
thousands = "0.2.0"
walkdir = "2.5.0"
zstd = { version = "0.13.3", features = ["zstdmt"] }

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,14 @@ bqtools info input.vbq --show-index

# print out the CBQ block headers
bqtools info input.cbq --show-headers

# export as json
bqtools info input.cbq --json
```

> Note: using `info` without the `--json` flag will format the number of records to include underscores to delimit the thousands.
> To avoid this behavior or to pass raw numerical values forward use the `--json` flag.

### Grep

You can easily search for specific subsequences or regular expressions within BINSEQ files:
Expand Down
10 changes: 6 additions & 4 deletions src/cli/info.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use clap::Parser;

use super::InputBinseq;

#[derive(Parser, Debug)]
/// Show information about a BINSEQ file.
pub struct InfoCommand {
#[clap(flatten)]
pub input: InputBinseq,
#[clap(num_args=1.., required=true)]
pub input: Vec<String>,

#[clap(flatten)]
pub opts: InfoOpts,
Expand All @@ -19,6 +17,10 @@ pub struct InfoOpts {
#[clap(short, long)]
pub num: bool,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The num flag is implemented as mutually exclusive with other output modes in the run function (via the else if chain), but this constraint is not enforced in the CLI definition. This allows users to provide conflicting flags (e.g., --num --show-index) where only one will be honored without warning. Adding conflicts_with_all would improve the user experience and maintain consistency with the json flag definition.

Suggested change
#[clap(short, long)]
pub num: bool,
#[clap(short, long, conflicts_with_all=["show_index", "show_headers"])]


/// Print the file in JSON format
#[clap(short, long, conflicts_with_all=["show_index", "show_headers", "num"])]
pub json: bool,

/// Print the index of the file
#[clap(long)]
pub show_index: bool,
Expand Down
Loading
Loading