Skip to content

Commit

Permalink
Fix the hard code of max depth
Browse files Browse the repository at this point in the history
  • Loading branch information
Jedsek authored and bootandy committed Aug 23, 2022
1 parent 81d52e6 commit f60184e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion build.rs
Expand Up @@ -6,7 +6,8 @@ include!("src/cli.rs");
fn main() -> Result<(), Error> {
let outdir = "completions";
let app_name = "dust";
let mut cmd = build_cli();
let max_depth = usize::MAX.to_string();
let mut cmd = build_cli(&max_depth);

generate_to(Bash, &mut cmd, app_name, outdir)?;
generate_to(Zsh, &mut cmd, app_name, outdir)?;
Expand Down
4 changes: 2 additions & 2 deletions src/cli.rs
@@ -1,6 +1,6 @@
use clap::{Arg, Command};

pub(crate) fn build_cli() -> Command<'static> {
pub fn build_cli(max_depth: &str) -> Command {
Command::new("Dust")
.about("Like du but more intuitive")
.version(env!("CARGO_PKG_VERSION"))
Expand All @@ -11,7 +11,7 @@ pub(crate) fn build_cli() -> Command<'static> {
.long("depth")
.help("Depth to show")
.takes_value(true)
.default_value("18446744073709551615")
.default_value(max_depth)
)
.arg(
Arg::new("number_of_lines")
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Expand Up @@ -90,7 +90,7 @@ fn get_regex_value(maybe_value: Option<Values>) -> Vec<Regex> {
}

fn main() {
let options = build_cli().get_matches();
let options = build_cli(&usize::MAX.to_string()).get_matches();

let config = get_config();

Expand Down

0 comments on commit f60184e

Please sign in to comment.