Skip to content

Commit

Permalink
Change --size to --geometry to avoid clashes in -s
Browse files Browse the repository at this point in the history
  • Loading branch information
ahcm committed Dec 26, 2021
1 parent a5946b6 commit f691c9b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hist-cli"
version = "0.4.1"
version = "0.4.2"
edition = "2021"
authors = ["Andreas Hauser <[email protected]>"]
description = "Commandline tool for plotting frequency ranked histograms of TSV/CSV data"
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export PATH="$HOME/.cargo/bin:$PATH"

## Usage
```
$ hist --help
hist 0.4.0
hist 0.4.2
Plots histogram of input
USAGE:
Expand All @@ -24,12 +23,12 @@ FLAGS:
-V, --version Prints version information
OPTIONS:
-T, --Title <Title> optional title above the plot [default: Counts distribution]
-o, --output <output> file to save PNG plot to [default: histogram.png]
-s, --save <save> save counts data to file as TSV, use - for STDOUT
-s, --size <size> the x and y pixel sizes of the output file [default: 1280x960]
--xdesc <xdesc> x-axis label [default: Rank]
--ydesc <ydesc> y-axis label [default: Counts]
-T, --Title <Title> optional title above the plot [default: Counts distribution]
-g, --geometry <geometry> the x and y size of the plot [default: 1280x960]
-o, --output <output> file to save PNG plot to [default: histogram.png]
-s, --save <save> save counts data to file as TSV, use - for STDOUT
--xdesc <xdesc> x-axis label [default: Rank]
--ydesc <ydesc> y-axis label [default: Counts]
ARGS:
<input> optional file with on entry per line [default: STDIN]
Expand Down
12 changes: 6 additions & 6 deletions src/bin/hist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ struct Opt
Title: String,

#[structopt(short, long, default_value = "1280x960")]
/// the x and y pixel sizes of the output file
size: String,
/// the x and y size of the plot
geometry: String,

#[structopt(long, default_value = "Rank")]
/// x-axis label
Expand Down Expand Up @@ -141,10 +141,10 @@ fn plot_rank(sorted_counts : &Vec<usize>, opt : &Opt) -> Result<(), Box<dyn Erro
let y_dim = next_potence(max as f64) as usize;
let x_dim = (sorted_counts.len() as f64 * 1.1) as usize;

let (size_x_str, size_y_str) = opt.size.split_once("x").expect("size not in correct format");
let size_x = size_x_str.parse().expect("Unable to parse size x");
let size_y = size_y_str.parse().expect("Unable to parse size y");
let root = BitMapBackend::new(&opt.output, (size_x, size_y)).into_drawing_area();
let (geometry_x_str, geometry_y_str) = opt.geometry.split_once("x").expect("geometry not in correct format");
let geometry_x = geometry_x_str.parse().expect("Unable to parse geometry x");
let geometry_y = geometry_y_str.parse().expect("Unable to parse geometry y");
let root = BitMapBackend::new(&opt.output, (geometry_x, geometry_y)).into_drawing_area();

root.fill(&WHITE)?;

Expand Down

0 comments on commit f691c9b

Please sign in to comment.