diff --git a/src/main.rs b/src/main.rs index ff9ac99..5ad0b90 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#![forbid(unsafe_code)] + use std::io::{stdout, BufWriter}; use std::path::Path; @@ -130,7 +132,7 @@ fn main() { let mut buffered_stdout = BufWriter::new(stdout()); let result = match args.output_format { - OutputFormat::Script => Script::new().write_all(&results, &mut buffered_stdout), + OutputFormat::Sh => Script::new().write_all(&results, &mut buffered_stdout), OutputFormat::PowerShell | OutputFormat::Powershell => PowerShell::new().write_all(&results, &mut buffered_stdout), OutputFormat::Text => todo!(), }; diff --git a/src/parameters.rs b/src/parameters.rs index ee0989d..527443e 100644 --- a/src/parameters.rs +++ b/src/parameters.rs @@ -10,14 +10,14 @@ cfg_if! { if #[cfg(windows)] { const DEFAULT_FORMAT: &str = "powershell"; } else { - const DEFAULT_FORMAT: &str = "script"; + const DEFAULT_FORMAT: &str = "sh"; } } #[derive(Clap, PartialEq, Debug)] pub enum OutputFormat { /// A Bourne shell compatible script. - Script, + Sh, /// A PowerShell script. PowerShell, /// Also a PowerShell script, with different casing to allow for `fif -o powershell`. @@ -41,31 +41,38 @@ pub enum OutputFormat { setting(AppSettings::ColoredHelp) )] pub struct Parameters { - /// Only examine files with these extensions (Comma-separated list) + /// Only examine files with these extensions (Comma-separated list). + /// This argument conflicts with `-E`. #[clap(short, long, use_delimiter = true, require_delimiter = true, group = "extensions")] pub exts: Option>, - /// Use a preset list of extensions as the search filter + /// Use a preset list of extensions as the search filter. + /// `media` includes all extensions from the `audio`, `video`, and `images` sets. This argument conflicts with `-e`. #[clap(short = 'E', long, arg_enum, group = "extensions")] pub ext_set: Option, - /// Don't skip hidden files and directories + /// 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. #[clap(short, long)] pub scan_hidden: bool, - /// Scan files without extensions + /// 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`. #[clap(short = 'S', long)] pub scan_extensionless: bool, - /// Output format to use + /// Output format to use. + /// By default, fif will output a PowerShell script on Windows, and a Bourne Shell script on other platforms. #[clap(short, long, default_value = DEFAULT_FORMAT, arg_enum)] pub output_format: OutputFormat, - /// Follow symlinks + /// Follow symlinks. #[clap(short, long)] pub follow_symlinks: bool, - /// Directory to process + /// The directory to process. // TODO: right now this can only take a single directory - should this be improved? #[clap(name = "DIR", default_value = ".", parse(from_os_str))] pub dirs: PathBuf,