Struct fif::parameters::Parameters
source · pub struct Parameters {Show 17 fields
pub fix: bool,
pub prompt: Option<Prompt>,
pub overwrite: bool,
pub exts: Option<Vec<String>>,
pub ext_set: Vec<ExtensionSet>,
pub exclude: Option<Vec<String>>,
pub exclude_set: Vec<ExtensionSet>,
pub scan_hidden: bool,
pub scan_extensionless: bool,
pub follow_symlinks: bool,
pub ignore_unknown_exts: bool,
pub output_format: OutputFormat,
pub verbose: u8,
pub quiet: u8,
pub canonical_paths: bool,
pub dir: PathBuf,
pub jobs: usize,
}
Expand description
[Clap
]-derived struct used to parse command line arguments.
Fields§
§fix: bool
Automatically rename files to use the correct extension, prompting the user for every rename.
prompt: Option<Prompt>
Requires –fix. Should fif prompt you Never
, only on Error
s and overwrites, or Always
?
overwrite: bool
Requires –fix. Allow overwriting files. Warning: When used in combination with --prompt never
, fif will
overwrite files without prompting!
exts: Option<Vec<String>>
Only examine files with these extensions.
Multiple extensions can be specified by either using the flag multiple times (-e jpg -e png -e gif
), or by
separating them with commas (-e jpg,png,gif
).
ext_set: Vec<ExtensionSet>
Use these preset lists of extensions as the search filter (comma-separated list).
media
includes all extensions from the audio
, video
, and images
sets, making -E media
equivalent to
-E audio,video,images
.
exclude: Option<Vec<String>>
Don’t scan files with these extensions.
This option takes precedence over extensions specified with -e
or -E
.
exclude_set: Vec<ExtensionSet>
Exclude files using a preset list of extensions.
This option takes precedence over extensions specified with -e
or -E
.
Don’t skip hidden files and directories.
Even if this flag is not present, fif will still recurse into a hidden root directory - for example, fif ~/.hidden
will recurse into ~/.hidden
regardless of whether or not -s was passed as an argument.
scan_extensionless: bool
Scan files without extensions.
By default, fif will ignore files without extensions - for example, a jpeg file named photo
won’t be considered
misnamed. Supplying the -S flag will cause fif to recommend renaming this file to photo.jpg
.
follow_symlinks: bool
Follow symlinks.
ignore_unknown_exts: bool
Don’t rename files with extensions unknown to fif. For example, with this option, fif will not rename “image.unknown” to “image.jpg”
output_format: OutputFormat
Output format to use. By default, fif will output a PowerShell script on Windows, and a Bourne Shell script on other platforms.
verbose: u8
Output verbosity. Each additional -v
increases verbosity.
Can be overridden by FIF_LOG
or RUST_LOG
.
quiet: u8
Output quietness. Each additional -q
decreases verbosity.
Can be overridden by FIF_LOG
or RUST_LOG
.
canonical_paths: bool
Use canonical (absolute) paths in output. A canonical path is the “one true path” to a given file, and is always an absolute path. While a file may have many absolute paths (for example, on Windows, ‘\?\C:\file.txt’ and ‘C:\file.txt’ are both absolute paths to the same file), but only one canonical path. This does not effect logged output.
dir: PathBuf
The directory to process.
jobs: usize
Number of jobs (threads) to use when scanning results.
The default behaviour is to use one thread per CPU thread. This behaviour can be manually requested by setting
-j 0
. Using -j 1
will disable multi-threading behaviour, as if you had compiled fif with the multi-threading
feature disabled. Setting more jobs than you have CPU threads is not recommended.
Implementations§
source§impl Parameters
impl Parameters
sourcepub fn extensions(&self) -> Option<BTreeSet<&str>>
pub fn extensions(&self) -> Option<BTreeSet<&str>>
Returns an optional vec of the extensions to be scanned - i.e., extensions specified via the -e
or -E
flag,
minus the extensions excluded with the -x
flag; i.e., the difference between the included and excluded sets.
sourcepub fn included_extensions(&self) -> Option<BTreeSet<&str>>
pub fn included_extensions(&self) -> Option<BTreeSet<&str>>
Returns an optional vec of extensions that were specified by -e
or -E
. Note that this doesn’t account for
extensions excluded by the exclusion flags.
sourcepub fn excluded_extensions(&self) -> Option<BTreeSet<&str>>
pub fn excluded_extensions(&self) -> Option<BTreeSet<&str>>
Returns an optional vec of extensions that were specified by -x
or -X
.
sourcepub const fn get_scan_opts(&self) -> ScanOpts
pub const fn get_scan_opts(&self) -> ScanOpts
sourcepub const fn get_verbosity(&self) -> LevelFilter
pub const fn get_verbosity(&self) -> LevelFilter
Gets the verbosity set by the user via the -v
and -q
flags.
Trait Implementations§
source§impl Args for Parameters
impl Args for Parameters
source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
source§impl CommandFactory for Parameters
impl CommandFactory for Parameters
source§impl Debug for Parameters
impl Debug for Parameters
source§impl FromArgMatches for Parameters
impl FromArgMatches for Parameters
source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.source§impl Parser for Parameters
impl Parser for Parameters
source§fn parse_from<I, T>(itr: I) -> Self
fn parse_from<I, T>(itr: I) -> Self
source§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
source§fn update_from<I, T>(&mut self, itr: I)
fn update_from<I, T>(&mut self, itr: I)
Auto Trait Implementations§
impl Freeze for Parameters
impl RefUnwindSafe for Parameters
impl Send for Parameters
impl Sync for Parameters
impl Unpin for Parameters
impl UnwindSafe for Parameters
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more