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 Errors 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.

§scan_hidden: bool

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

source

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.

source

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.

source

pub fn excluded_extensions(&self) -> Option<BTreeSet<&str>>

Returns an optional vec of extensions that were specified by -x or -X.

source

pub const fn get_scan_opts(&self) -> ScanOpts

Populates a ScanOpts struct with values from self.

source

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

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self. Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can update self. Read more
source§

impl CommandFactory for Parameters

source§

fn command<'b>() -> Command

Build a [Command] that can instantiate Self. Read more
source§

fn command_for_update<'b>() -> Command

Build a [Command] that can update self. Read more
source§

impl Debug for Parameters

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromArgMatches for Parameters

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

impl Parser for Parameters

§

fn parse() -> Self

Parse from std::env::args_os(), exit on error
§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error
§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error
§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.