From fae9ce670c1b6553d0e160bacc9a28f3c7d16875 Mon Sep 17 00:00:00 2001 From: sudotac Date: Sat, 3 Feb 2024 17:38:43 +0900 Subject: [PATCH 1/2] Bump clap_complete to 4.4.10 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e49526d..65161a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -207,9 +207,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.8" +version = "4.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf7dcb7c21d8ca1a2482ee0f1d341f437c9a7af6ca6da359dc5e1b164e98215" +checksum = "abb745187d7f4d76267b37485a65e0149edd0e91a4cfcdd3f27524ad86cee9f3" dependencies = [ "clap", ] diff --git a/Cargo.toml b/Cargo.toml index ca2681a..df4d095 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" anyhow = "1.0.53" blake3 = "1.3.3" clap = { version = "4", features = ["derive", "env", "wrap_help"] } -clap_complete = "4" +clap_complete = "4.4.10" console = "0.15.4" dirs = "5" fastrand = "2" From e884298d9c6762aed1e41a351327f4c63ae75ec6 Mon Sep 17 00:00:00 2001 From: sudotac Date: Sat, 3 Feb 2024 17:41:30 +0900 Subject: [PATCH 2/2] Specify value_hint macro for better completion Fix #180 --- src/command/args.rs | 6 +++--- src/command/args/encode.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/command/args.rs b/src/command/args.rs index 70a5481..c186322 100644 --- a/src/command/args.rs +++ b/src/command/args.rs @@ -6,7 +6,7 @@ pub use encode::*; pub use vmaf::*; use crate::{command::encode::default_output_ext, ffprobe::Ffprobe}; -use clap::Parser; +use clap::{Parser, ValueHint}; use std::{ path::{Path, PathBuf}, sync::Arc, @@ -19,7 +19,7 @@ pub struct EncodeToOutput { /// Output file, by default the same as input with `.av1` before the extension. /// /// E.g. if unspecified: -i vid.mkv --> vid.av1.mkv - #[arg(short, long)] + #[arg(short, long, value_hint = ValueHint::FilePath)] pub output: Option, /// Set the output ffmpeg audio codec. @@ -69,7 +69,7 @@ pub struct Sample { /// Directory to store temporary sample data in. /// Defaults to using the input's directory. - #[arg(long, env = "AB_AV1_TEMP_DIR")] + #[arg(long, env = "AB_AV1_TEMP_DIR", value_hint = ValueHint::DirPath)] pub temp_dir: Option, /// Extension preference for encoded samples (ffmpeg encoder only). diff --git a/src/command/args/encode.rs b/src/command/args/encode.rs index 7cd1b02..e3981c9 100644 --- a/src/command/args/encode.rs +++ b/src/command/args/encode.rs @@ -4,7 +4,7 @@ use crate::{ float::TerseF32, }; use anyhow::ensure; -use clap::Parser; +use clap::{Parser, ValueHint}; use std::{ collections::HashMap, fmt::{self, Write}, @@ -23,7 +23,7 @@ pub struct Encode { pub encoder: Encoder, /// Input video file. - #[arg(short, long)] + #[arg(short, long, value_hint = ValueHint::FilePath)] pub input: PathBuf, /// Ffmpeg video filter applied to the input before av1 encoding.