mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
feat: support --files-from/--files0-from
Read NUL- or newline-terminated paths from FILE or stdin. Wire options through `config` and `main`. Add tests and update the man page, README, and completion scripts.
This commit is contained in:
committed by
andy.boot
parent
14efddfd05
commit
7974e2eaf0
+10
-1
@@ -36,16 +36,25 @@ pub struct Config {
|
||||
pub output_json: Option<bool>,
|
||||
pub print_errors: Option<bool>,
|
||||
pub files0_from: Option<String>,
|
||||
pub files_from: Option<String>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn get_files_from(&self, options: &Cli) -> Option<String> {
|
||||
pub fn get_files0_from(&self, options: &Cli) -> Option<String> {
|
||||
let from_file = &options.files0_from;
|
||||
match from_file {
|
||||
None => self.files0_from.as_ref().map(|x| x.to_string()),
|
||||
Some(x) => Some(x.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_files_from(&self, options: &Cli) -> Option<String> {
|
||||
let from_file = &options.files_from;
|
||||
match from_file {
|
||||
None => self.files_from.as_ref().map(|x| x.to_string()),
|
||||
Some(x) => Some(x.to_string()),
|
||||
}
|
||||
}
|
||||
pub fn get_no_colors(&self, options: &Cli) -> bool {
|
||||
Some(true) == self.no_colors || options.no_colors
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user