release v0.5.0 🥳
This commit is contained in:
parent
9aef5d314c
commit
c06a7a527a
9 changed files with 48 additions and 59 deletions
|
@ -105,7 +105,7 @@ build-base-stable:
|
|||
|
||||
build-base-msrv:
|
||||
extends: build-base-stable
|
||||
image: "rust:1.48.0"
|
||||
image: "rust:1.54.0"
|
||||
cache:
|
||||
key: msrv
|
||||
paths:
|
||||
|
@ -131,7 +131,7 @@ build-stable:
|
|||
build-msrv:
|
||||
extends: build-stable
|
||||
needs: ["build-base-msrv"]
|
||||
image: "rust:1.48.0"
|
||||
image: "rust:1.54.0"
|
||||
cache:
|
||||
key: msrv
|
||||
paths:
|
||||
|
@ -156,7 +156,7 @@ test-stable:
|
|||
|
||||
test-msrv:
|
||||
extends: test-stable
|
||||
image: "rust:1.48.0"
|
||||
image: "rust:1.54.0"
|
||||
needs: ["build-msrv"]
|
||||
cache:
|
||||
key: msrv
|
||||
|
|
|
@ -4,8 +4,9 @@ Dates are given in YYYY-MM-DD format - for example, the 15th of October 2021 is
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
||||
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
## v0.5.0 - 2022-01-01
|
||||
### Changed
|
||||
- The Minimum Supported Rust Version (MSRV) is now **1.54.0**.
|
||||
- Updated [`new_mime_guess`] to 4.0.0
|
||||
- `--version` output now handles missing Git commit hashes, and specifies the target operating system
|
||||
### Fixed
|
||||
|
|
42
Cargo.lock
generated
42
Cargo.lock
generated
|
@ -2,15 +2,6 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.5.2"
|
||||
|
@ -89,9 +80,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.0.0-beta.2"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142"
|
||||
checksum = "d17bf219fcd37199b9a29e00ba65dfb8cd5b2688b7297ec14ff829c40ac50ca9"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
|
@ -102,15 +93,14 @@ dependencies = [
|
|||
"termcolor",
|
||||
"terminal_size",
|
||||
"textwrap",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "3.0.0-beta.2"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1"
|
||||
checksum = "e1b9752c030a14235a0bd5ef3ad60a1dcac8468c30921327fc8af36b20c790b9"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
|
@ -221,12 +211,11 @@ checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193"
|
|||
|
||||
[[package]]
|
||||
name = "fif"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"assert_cmd",
|
||||
"cfg-if",
|
||||
"clap",
|
||||
"clap_derive",
|
||||
"env_logger",
|
||||
"exitcode",
|
||||
"infer",
|
||||
|
@ -445,9 +434,12 @@ checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
|
|||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "2.4.0"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85"
|
||||
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
|
@ -678,8 +670,6 @@ version = "1.5.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
|
@ -845,9 +835,9 @@ checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16"
|
|||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.12.1"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
|
||||
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
|
||||
dependencies = [
|
||||
"terminal_size",
|
||||
"unicode-width",
|
||||
|
@ -912,12 +902,6 @@ version = "0.8.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
|
|
16
Cargo.toml
16
Cargo.toml
|
@ -4,11 +4,11 @@
|
|||
[package]
|
||||
name = "fif"
|
||||
description = "A command-line tool for detecting and optionally correcting files with incorrect extensions."
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
authors = ["Lynnesbian <lynne@bune.city>"]
|
||||
edition = "2018"
|
||||
license = "GPL-3.0-or-later"
|
||||
rust-version = "1.48.0" # this can actually go as low as 1.41.0 after removing cached, but i'll leave it 1.43.0
|
||||
rust-version = "1.54.0" # clap 3 requires >=1.54.0
|
||||
repository = "https://gitlab.com/Lynnesbian/fif"
|
||||
readme = "README.md"
|
||||
keywords = ["mime", "mimetype", "utilities", "tools"]
|
||||
|
@ -62,13 +62,9 @@ smartstring = ">= 0.2.4"
|
|||
|
||||
[dependencies.clap]
|
||||
# beta.4 requires rust >= 1.54.0 (and beta.3 was yanked)
|
||||
version = "=3.0.0-beta.2"
|
||||
version = "3.0.0"
|
||||
default-features = false
|
||||
features = ["wrap_help", "color", "derive", "std"]
|
||||
|
||||
[dependencies.clap_derive]
|
||||
# without this, clap beta.2 will install clap_derive beta.4 :c
|
||||
version = "=3.0.0-beta.2"
|
||||
features = ["wrap_help", "color", "derive", "std", "unicode"]
|
||||
|
||||
[dependencies.env_logger]
|
||||
version = "0.9.0"
|
||||
|
@ -79,7 +75,7 @@ features = ["termcolor", "atty"]
|
|||
tempfile = "3.2.0"
|
||||
rand = "0.8.3"
|
||||
assert_cmd = "2.0.2"
|
||||
regex = "1.5.4"
|
||||
regex = { version = "1.5.4", default-features = false, features = ["std"] }
|
||||
|
||||
[profile.release]
|
||||
lto = "thin"
|
||||
|
@ -92,4 +88,4 @@ opt-level = 3
|
|||
opt-level = 3
|
||||
|
||||
[package.metadata]
|
||||
msrv = "1.48.0"
|
||||
msrv = "1.54.0"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
[![Version](https://img.shields.io/crates/v/fif.svg?logo=rust&style=flat-square)
|
||||
](https://crates.io/crates/fif)
|
||||
[![Minimum Supported Rust Version](https://img.shields.io/badge/msrv-1.48.0-orange?logo=rust&style=flat-square)
|
||||
[![Minimum Supported Rust Version](https://img.shields.io/badge/msrv-1.54.0-orange?logo=rust&style=flat-square)
|
||||
](https://gitlab.com/Lynnesbian/fif/-/blob/master/README.md#version-policy)
|
||||
[![License](https://img.shields.io/crates/l/fif.svg?style=flat-square)
|
||||
](https://gitlab.com/Lynnesbian/fif/-/blob/master/LICENSE)
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
|
||||
# avoid-breaking-exported-api = false # only available on nightly for now
|
||||
cognitive-complexity-threshold = 15
|
||||
msrv = "1.48.0"
|
||||
msrv = "1.54.0"
|
||||
|
|
|
@ -16,7 +16,7 @@ use std::io::{stdin, stdout, BufWriter, Write};
|
|||
use std::process::exit;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use clap::Clap;
|
||||
use clap::Parser;
|
||||
use fif::files::{scan_directory, scan_from_walkdir};
|
||||
use fif::formats::{self, Format};
|
||||
use fif::parameters::{self, OutputFormat, Prompt};
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::collections::BTreeSet;
|
|||
use std::path::PathBuf;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use clap::{AppSettings, Clap};
|
||||
use clap::{Parser, ArgEnum};
|
||||
|
||||
use crate::utils::{CLAP_LONG_VERSION, CLAP_VERSION};
|
||||
use crate::String as StringType;
|
||||
|
@ -22,7 +22,7 @@ cfg_if! {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clap, PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(ArgEnum, PartialEq, Debug, Copy, Clone)]
|
||||
/// The format to use when running fif without the `--fix` flag. Specified at runtime with the `-o`/`--output-format`
|
||||
/// flag.
|
||||
pub enum OutputFormat {
|
||||
|
@ -39,7 +39,7 @@ pub enum OutputFormat {
|
|||
Json,
|
||||
}
|
||||
|
||||
#[derive(Clap, PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(ArgEnum, PartialEq, Debug, Copy, Clone)]
|
||||
/// Specifies under what conditions the user should be prompted when running fif in `--fix` mode. Defaults to `Error`.
|
||||
/// Specified at runtime with the `-p`/`--prompt` flag.
|
||||
pub enum Prompt {
|
||||
|
@ -51,7 +51,7 @@ pub enum Prompt {
|
|||
Always,
|
||||
}
|
||||
|
||||
#[derive(Clap, Debug)]
|
||||
#[derive(Parser, Debug)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[clap(
|
||||
version = CLAP_VERSION.as_str(),
|
||||
|
@ -63,7 +63,6 @@ pub enum Prompt {
|
|||
This program is free software: you can redistribute it and/or modify \
|
||||
it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 \
|
||||
of the License, or (at your option) any later version.",
|
||||
setting(AppSettings::ColoredHelp),
|
||||
max_term_width = 120
|
||||
)]
|
||||
/// [`Clap`]-derived struct used to parse command line arguments.
|
||||
|
@ -88,7 +87,7 @@ pub struct Parameters {
|
|||
/// 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`).
|
||||
#[clap(short, long, use_delimiter = true, require_delimiter = true, value_name = "ext", validator = lowercase_exts)]
|
||||
#[clap(short, long, use_delimiter = true, require_delimiter = true, value_name = "ext", takes_value = true, validator = validate_exts)]
|
||||
pub exts: Option<Vec<StringType>>,
|
||||
|
||||
/// Use these preset lists of extensions as the search filter (comma-separated list).
|
||||
|
@ -106,7 +105,8 @@ pub struct Parameters {
|
|||
|
||||
/// Don't scan files with these extensions.
|
||||
/// This option takes precedence over extensions specified with `-e` or `-E`.
|
||||
#[clap(short = 'x', long, use_delimiter = true, require_delimiter = true, value_name = "ext", validator = lowercase_exts)]
|
||||
#[clap(short = 'x', long, use_delimiter = true, require_delimiter = true, value_name = "ext", validator =
|
||||
validate_exts)]
|
||||
pub exclude: Option<Vec<StringType>>,
|
||||
|
||||
/// Exclude files using a preset list of extensions.
|
||||
|
@ -177,9 +177,15 @@ pub struct Parameters {
|
|||
pub jobs: usize,
|
||||
}
|
||||
|
||||
/// Validation function for argument parsing that ensures passed-in extensions are lowercase.
|
||||
fn lowercase_exts(exts: &str) -> Result<(), String> {
|
||||
/// Validation function for argument parsing that ensures passed-in extensions are lowercase, and that the user
|
||||
/// didn't supply an empty list.
|
||||
fn validate_exts(exts: &str) -> Result<(), String> {
|
||||
// TODO: i would much rather accept uppercase exts and convert them to lowercase than just rejecting lowercase exts...
|
||||
|
||||
if exts.is_empty() {
|
||||
return Err(String::from("Cannot specify empty extensions"));
|
||||
}
|
||||
|
||||
if exts.to_lowercase() != exts {
|
||||
return Err(String::from("Supplied extensions must be lowercase"));
|
||||
}
|
||||
|
@ -290,7 +296,7 @@ impl Parameters {
|
|||
}
|
||||
|
||||
/// Sets of extensions for use with [Parameter](crate::parameters::Parameters)'s `-E` flag.
|
||||
#[derive(Clap, PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(ArgEnum, PartialEq, Debug, Copy, Clone)]
|
||||
pub enum ExtensionSet {
|
||||
/// Extensions used for image file formats, such as `png`, `jpeg`, `webp`, etc.
|
||||
Images,
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::collections::{BTreeMap, HashMap};
|
|||
use std::ffi::OsStr;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use clap::Clap;
|
||||
use clap::Parser;
|
||||
use fif::files::{mime_extension_lookup, scan_directory, scan_from_walkdir, BUF_SIZE};
|
||||
use fif::findings::Findings;
|
||||
use fif::formats::{Format, PowerShell, Shell};
|
||||
|
@ -306,6 +306,8 @@ fn rejects_bad_args() {
|
|||
vec!["fif", "-X", "pebis"],
|
||||
// `-e` with nothing but commas:
|
||||
vec!["fif", "-e", ",,,,,"],
|
||||
// `-x` with nothing but commas:
|
||||
vec!["fif", "-x", ",,,,,"],
|
||||
// `-j` with a negative value:
|
||||
vec!["fif", "-j", "-1"],
|
||||
// `--prompt` without `--fix`:
|
||||
|
@ -357,7 +359,7 @@ fn check_version_output() {
|
|||
let output = cmd.arg("-V").ok().unwrap().stdout;
|
||||
let output = String::from_utf8(output).unwrap();
|
||||
assert!(
|
||||
Regex::new(r#"fif v(\d\.){2}\d"#).unwrap().is_match(output.trim()),
|
||||
Regex::new(r#"fif v([0-9]\.){2}[0-9]"#).unwrap().is_match(output.trim()),
|
||||
"\"{}\" does not match the expected `-v` format!",
|
||||
output
|
||||
);
|
||||
|
@ -368,7 +370,7 @@ fn check_version_output() {
|
|||
let output = cmd.arg("--version").ok().unwrap().stdout;
|
||||
let output = String::from_utf8(output).unwrap();
|
||||
assert!(
|
||||
Regex::new(r#"fif v(\d\.){2}\d \(.+, .+ backend, (unknown commit|commit #[\da-f]{7})\)"#)
|
||||
Regex::new(r#"fif v([0-9]\.){2}[0-9] \(.+, .+ backend, (unknown commit|commit #[[:xdigit:]]{7})\)"#)
|
||||
.unwrap()
|
||||
.is_match(output.trim()),
|
||||
"\"{}\" does not match the expected `--version` format!",
|
||||
|
|
Loading…
Reference in a new issue