Compare commits
3 commits
master
...
35322075ab
Author | SHA1 | Date | |
---|---|---|---|
35322075ab | |||
aeb7c05377 | |||
77ed918112 |
8 changed files with 70 additions and 77 deletions
|
@ -81,15 +81,14 @@ clippy:
|
||||||
cleanup-stable:
|
cleanup-stable:
|
||||||
extends: .cargo-cleanup
|
extends: .cargo-cleanup
|
||||||
|
|
||||||
# commented out because cargo-sweep no longer works on our MSRV
|
cleanup-msrv:
|
||||||
#cleanup-msrv:
|
extends: cleanup-stable
|
||||||
# extends: cleanup-stable
|
image: "rust:1.56.0"
|
||||||
# image: "rust:1.43.0"
|
cache:
|
||||||
# cache:
|
key: msrv
|
||||||
# key: msrv
|
paths:
|
||||||
# paths:
|
- target
|
||||||
# - target
|
- .cargo
|
||||||
# - .cargo
|
|
||||||
|
|
||||||
cleanup-nightly:
|
cleanup-nightly:
|
||||||
extends: cleanup-stable
|
extends: cleanup-stable
|
||||||
|
@ -107,8 +106,8 @@ build-base-stable:
|
||||||
|
|
||||||
build-base-msrv:
|
build-base-msrv:
|
||||||
extends: build-base-stable
|
extends: build-base-stable
|
||||||
# needs: ["cleanup-msrv"]
|
needs: ["cleanup-msrv"]
|
||||||
image: "rust:1.43.0"
|
image: "rust:1.56.0"
|
||||||
cache:
|
cache:
|
||||||
key: msrv
|
key: msrv
|
||||||
paths:
|
paths:
|
||||||
|
@ -134,7 +133,7 @@ build-stable:
|
||||||
build-msrv:
|
build-msrv:
|
||||||
extends: build-stable
|
extends: build-stable
|
||||||
needs: ["build-base-msrv"]
|
needs: ["build-base-msrv"]
|
||||||
image: "rust:1.43.0"
|
image: "rust:1.56.0"
|
||||||
cache:
|
cache:
|
||||||
key: msrv
|
key: msrv
|
||||||
paths:
|
paths:
|
||||||
|
@ -159,7 +158,7 @@ test-stable:
|
||||||
|
|
||||||
test-msrv:
|
test-msrv:
|
||||||
extends: test-stable
|
extends: test-stable
|
||||||
image: "rust:1.43.0"
|
image: "rust:1.56.0"
|
||||||
needs: ["build-msrv"]
|
needs: ["build-msrv"]
|
||||||
cache:
|
cache:
|
||||||
key: msrv
|
key: msrv
|
||||||
|
|
|
@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
## Changed
|
||||||
|
- MSRV is now 1.56.0
|
||||||
|
- A few dependencies have been updated, most notably [`clap`]
|
||||||
### Added
|
### Added
|
||||||
- AIFF (Audio Interchange File Format, a PCM audio format like WAV) detection to [`infer`]
|
- AIFF (Audio Interchange File Format, a PCM audio format like WAV) detection to [`infer`]
|
||||||
- `--version` output now includes the (short) hash of the git commit fif was built from
|
- `--version` output now includes the (short) hash of the git commit fif was built from
|
||||||
|
|
57
Cargo.lock
generated
57
Cargo.lock
generated
|
@ -1,5 +1,7 @@
|
||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
|
@ -63,9 +65,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "3.0.0-beta.2"
|
version = "3.0.0-beta.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142"
|
checksum = "fcd70aa5597dbc42f7217a543f9ef2768b2ef823ba29036072d30e1d88e98406"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
@ -76,15 +78,14 @@ dependencies = [
|
||||||
"termcolor",
|
"termcolor",
|
||||||
"terminal_size",
|
"terminal_size",
|
||||||
"textwrap",
|
"textwrap",
|
||||||
"unicode-width",
|
|
||||||
"vec_map",
|
"vec_map",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "3.0.0-beta.2"
|
version = "3.0.0-beta.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1"
|
checksum = "0b5bb0d655624a0b8770d1c178fb8ffcb1f91cc722cb08f451e3dc72465421ac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro-error",
|
"proc-macro-error",
|
||||||
|
@ -185,11 +186,9 @@ checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193"
|
||||||
name = "fif"
|
name = "fif"
|
||||||
version = "0.3.6"
|
version = "0.3.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
|
||||||
"cached",
|
"cached",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"clap",
|
"clap",
|
||||||
"clap_derive",
|
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"exitcode",
|
"exitcode",
|
||||||
"infer",
|
"infer",
|
||||||
|
@ -347,10 +346,11 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "new_mime_guess"
|
name = "new_mime_guess"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c8c8e990db7ba41ce2b4b3a38380a0f3385d61c55b3d4999d6e00389562a79a2"
|
checksum = "b101054f57b10576d116bc0da7ce8b05362b4490b0d21c7748395eaaf9359047"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
"mime",
|
"mime",
|
||||||
"phf",
|
"phf",
|
||||||
"phf_codegen",
|
"phf_codegen",
|
||||||
|
@ -386,24 +386,24 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "os_str_bytes"
|
name = "os_str_bytes"
|
||||||
version = "2.4.0"
|
version = "3.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85"
|
checksum = "6acbef58a60fe69ab50510a55bc8cdd4d6cf2283d27ad338f54cb52747a9cf2d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "phf"
|
name = "phf"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b2ac8b67553a7ca9457ce0e526948cad581819238f4a9d1ea74545851fa24f37"
|
checksum = "b9fc3db1018c4b59d7d582a739436478b6035138b6aecbce989fc91c3e98409f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"phf_shared",
|
"phf_shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "phf_codegen"
|
name = "phf_codegen"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "963adb11cf22ee65dfd401cf75577c1aa0eca58c0b97f9337d2da61d3e640503"
|
checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"phf_generator",
|
"phf_generator",
|
||||||
"phf_shared",
|
"phf_shared",
|
||||||
|
@ -411,9 +411,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "phf_generator"
|
name = "phf_generator"
|
||||||
version = "0.9.1"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d43f3220d96e0080cc9ea234978ccd80d904eafb17be31bb0f76daaea6493082"
|
checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"phf_shared",
|
"phf_shared",
|
||||||
"rand",
|
"rand",
|
||||||
|
@ -421,9 +421,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "phf_shared"
|
name = "phf_shared"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a68318426de33640f02be62b4ae8eb1261be2efbc337b60c54d845bf4484e0d9"
|
checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"siphasher",
|
"siphasher",
|
||||||
"unicase",
|
"unicase",
|
||||||
|
@ -630,9 +630,9 @@ checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smartstring"
|
name = "smartstring"
|
||||||
version = "0.2.7"
|
version = "0.2.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "29620fe111ceaba7a50fd806b5f44c1ef44a697a739f6677a4464c7ea8685997"
|
checksum = "31aa6a31c0c2b21327ce875f7e8952322acfcfd0c27569a6e18a647281352c9b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
]
|
]
|
||||||
|
@ -655,9 +655,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.76"
|
version = "1.0.77"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84"
|
checksum = "5239bc68e0fef57495900cfea4e8dc75596d9a319d7e16b1e0a440d24e6fe0a0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -699,12 +699,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "textwrap"
|
name = "textwrap"
|
||||||
version = "0.12.1"
|
version = "0.14.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
|
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"terminal_size",
|
"terminal_size",
|
||||||
"unicode-width",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -742,12 +741,6 @@ version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
|
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-width"
|
|
||||||
version = "0.1.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
|
|
33
Cargo.toml
33
Cargo.toml
|
@ -3,16 +3,22 @@ name = "fif"
|
||||||
description = "A command-line tool for detecting and optionally correcting files with incorrect extensions."
|
description = "A command-line tool for detecting and optionally correcting files with incorrect extensions."
|
||||||
version = "0.3.6"
|
version = "0.3.6"
|
||||||
authors = ["Lynnesbian <lynne@bune.city>"]
|
authors = ["Lynnesbian <lynne@bune.city>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
rust-version = "1.43.0" # cached breaks on 1.42.0, i think it needs https://github.com/rust-lang/rust/pull/67642/
|
rust-version = "1.56.0"
|
||||||
repository = "https://gitlab.com/Lynnesbian/fif"
|
repository = "https://gitlab.com/Lynnesbian/fif"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["mime", "mimetype", "utilities", "tools"]
|
keywords = ["mime", "mimetype", "utilities", "tools"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
exclude = [".idea/", "*.toml", "!Cargo.toml", "*.sh", "*.py", "*.yml", "*.md", ".mailmap", "pkg/"]
|
exclude = [".idea/", "*.toml", "!Cargo.toml", "*.sh", "*.py", "*.yml", "*.md", ".mailmap", "pkg/"]
|
||||||
#resolver = "2"
|
|
||||||
#license-file = "LICENSE"
|
# unfortunately, we can't use resolver v2 right now, because one of the phf crates (i think it's phf_codegen) that are
|
||||||
|
# pulled in by new_mime_guess' phf-map feature doesn't enable phf_shared's unicase feature when it should.
|
||||||
|
# this causes new_mime_guess' build.rs to fail with errors about PhfHash traits and such not being implemented for
|
||||||
|
# UniCase<&str>.
|
||||||
|
# there's no way to fix this in either fif or new_mime_guess itself, short of a patch (which can't be used on
|
||||||
|
# crates.io), so we'll have to disable the new resolver for now :(
|
||||||
|
resolver = "1"
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
maintenance = { status = "experimental" }
|
maintenance = { status = "experimental" }
|
||||||
|
@ -37,7 +43,6 @@ cfg-if = "1.0.0"
|
||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||||
serde_json = { version = "1.0", optional = true }
|
serde_json = { version = "1.0", optional = true }
|
||||||
bitflags = "~1.2.1" # 1.3+ requires Rust >= 1.46
|
|
||||||
|
|
||||||
[target.'cfg(not(unix))'.dependencies]
|
[target.'cfg(not(unix))'.dependencies]
|
||||||
xdg-mime = { version = "0.3.3", optional = true }
|
xdg-mime = { version = "0.3.3", optional = true }
|
||||||
|
@ -49,27 +54,17 @@ infer = { version = "0.5.0", optional = true }
|
||||||
|
|
||||||
[target.'cfg(not(all(target_endian = "big", target_pointer_width = "32")))'.dependencies]
|
[target.'cfg(not(all(target_endian = "big", target_pointer_width = "32")))'.dependencies]
|
||||||
# the seemingly weird target constraint here is due to this:
|
# the seemingly weird target constraint here is due to this:
|
||||||
# https://github.com/bodil/smartstring/blob/v0.2.7/src/config.rs#L102-L104
|
# https://github.com/bodil/smartstring/blob/v0.2.9/src/config.rs#L91-L93
|
||||||
# essentially, smartstring is intentionally blocked from compiling on 32-bit big endian archs, so our dependency on it
|
# essentially, smartstring is intentionally blocked from compiling on 32-bit big endian archs, so our dependency on it
|
||||||
# needs to be too. otherwise, fif won't work on platforms like powerpc, even though this dependency is the only
|
# needs to be too. otherwise, fif won't work on platforms like powerpc, even though this dependency is the only
|
||||||
# blocker -- fif runs just fine on powerpc without smartstring. or at least, just fine under qemu user-mode powerpc ~u0
|
# blocker -- fif runs just fine on powerpc without smartstring. or at least, just fine under qemu user-mode powerpc ~u0
|
||||||
|
smartstring = "0.2.9"
|
||||||
# additionally, smartstring 0.2.8 requires rust >=1.46 (due to https://github.com/rust-lang/rust/issues/49146), and
|
|
||||||
# 0.2.3 doesn't impl Display on its SmartString type.
|
|
||||||
# so, we need at least 0.2.4 so we can println! strings, and at most 0.2.7 until we bump the MSRV to at least 1.46.
|
|
||||||
# see https://github.com/bodil/smartstring/blob/master/CHANGELOG.md
|
|
||||||
smartstring = "<= 0.2.7, >= 0.2.4"
|
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
# beta.4 requires rust >= 1.54.0 (and beta.3 was yanked)
|
version = "=3.0.0-beta.4"
|
||||||
version = "=3.0.0-beta.2"
|
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["wrap_help", "color", "derive", "std"]
|
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"
|
|
||||||
|
|
||||||
[dependencies.env_logger]
|
[dependencies.env_logger]
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
@ -94,4 +89,4 @@ opt-level = 3
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
|
||||||
[package.metadata]
|
[package.metadata]
|
||||||
msrv = "1.43.0"
|
msrv = "1.56.0"
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
[![Version](https://img.shields.io/crates/v/fif.svg?logo=rust&style=flat-square)
|
[![Version](https://img.shields.io/crates/v/fif.svg?logo=rust&style=flat-square)
|
||||||
](https://crates.io/crates/fif)
|
](https://crates.io/crates/fif)
|
||||||
[![Minimum Supported Rust Version](https://img.shields.io/badge/msrv-1.43.0-orange?logo=rust&style=flat-square)
|
[![Minimum Supported Rust Version](https://img.shields.io/badge/msrv-1.56.0-orange?logo=rust&style=flat-square)
|
||||||
](https://gitlab.com/Lynnesbian/fif/-/blob/master/README.md#version-policy)
|
](https://gitlab.com/Lynnesbian/fif/-/blob/master/README.md#version-policy)
|
||||||
[![License](https://img.shields.io/crates/l/fif.svg?style=flat-square)
|
[![License](https://img.shields.io/crates/l/fif.svg?style=flat-square)
|
||||||
](https://gitlab.com/Lynnesbian/fif/-/blob/master/LICENSE)
|
](https://gitlab.com/Lynnesbian/fif/-/blob/master/LICENSE)
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
# avoid-breaking-exported-api = false # only available on nightly for now
|
# avoid-breaking-exported-api = false # only available on nightly for now
|
||||||
cognitive-complexity-threshold = 15
|
cognitive-complexity-threshold = 15
|
||||||
|
msrv = "1.56.0"
|
|
@ -3,7 +3,7 @@
|
||||||
use crate::utils::{clap_long_version, clap_version};
|
use crate::utils::{clap_long_version, clap_version};
|
||||||
use crate::String as StringType;
|
use crate::String as StringType;
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
use clap::{AppSettings, Clap};
|
use clap::{AppSettings, ArgEnum, Clap};
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ cfg_if! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clap, PartialEq, Debug)]
|
#[derive(ArgEnum, PartialEq, Debug)]
|
||||||
pub enum OutputFormat {
|
pub enum OutputFormat {
|
||||||
/// A Bourne shell compatible script.
|
/// A Bourne shell compatible script.
|
||||||
#[clap(alias = "shell", alias = "bash")]
|
#[clap(alias = "shell", alias = "bash")]
|
||||||
|
@ -52,7 +52,7 @@ pub struct Parameters {
|
||||||
/// Only examine files with these extensions.
|
/// 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
|
/// 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`).
|
/// 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>>,
|
pub exts: Option<Vec<StringType>>,
|
||||||
|
|
||||||
/// Use these preset lists of extensions as the search filter (comma-separated list).
|
/// Use these preset lists of extensions as the search filter (comma-separated list).
|
||||||
|
@ -70,7 +70,7 @@ pub struct Parameters {
|
||||||
|
|
||||||
/// Don't scan files with these extensions.
|
/// Don't scan files with these extensions.
|
||||||
/// This option takes precedence over extensions specified with `-e` or `-E`.
|
/// 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, require_delimiter = true, use_delimiter = true, value_name = "ext", validator = validate_exts)]
|
||||||
pub exclude: Option<Vec<StringType>>,
|
pub exclude: Option<Vec<StringType>>,
|
||||||
|
|
||||||
/// Exclude files using a preset list of extensions.
|
/// Exclude files using a preset list of extensions.
|
||||||
|
@ -133,7 +133,10 @@ pub struct Parameters {
|
||||||
pub ignore_unknown_exts: bool,
|
pub ignore_unknown_exts: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lowercase_exts(exts: &str) -> Result<(), String> {
|
fn validate_exts(exts: &str) -> Result<(), String> {
|
||||||
|
if exts.is_empty() {
|
||||||
|
return Err(String::from("Cannot specify empty extensions"));
|
||||||
|
}
|
||||||
// TODO: i would much rather accept uppercase exts and convert them to lowercase than just rejecting lowercase exts...
|
// TODO: i would much rather accept uppercase exts and convert them to lowercase than just rejecting lowercase exts...
|
||||||
if exts.to_lowercase() != exts {
|
if exts.to_lowercase() != exts {
|
||||||
return Err(String::from("Supplied extensions must be lowercase"));
|
return Err(String::from("Supplied extensions must be lowercase"));
|
||||||
|
@ -224,10 +227,7 @@ impl Parameters {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_verbosity(&self) -> log::LevelFilter {
|
pub const fn default_verbosity(&self) -> log::LevelFilter {
|
||||||
#![allow(clippy::missing_const_for_fn)]
|
|
||||||
// match was not permitted inside const functions until 1.46
|
|
||||||
|
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
|
|
||||||
match self.quiet {
|
match self.quiet {
|
||||||
|
@ -246,7 +246,7 @@ impl Parameters {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets of extensions for use with [Parameter](crate::parameters::Parameters)'s `-E` flag.
|
/// Sets of extensions for use with [Parameter](crate::parameters::Parameters)'s `-E` flag.
|
||||||
#[derive(Clap, PartialEq, Debug)]
|
#[derive(ArgEnum, PartialEq, Debug)]
|
||||||
pub enum ExtensionSet {
|
pub enum ExtensionSet {
|
||||||
/// Extensions used for image file formats, such as `png`, `jpeg`, `webp`, etc.
|
/// Extensions used for image file formats, such as `png`, `jpeg`, `webp`, etc.
|
||||||
Images,
|
Images,
|
||||||
|
|
4
test.py
4
test.py
|
@ -24,7 +24,9 @@ def test_versions():
|
||||||
print("Couldn't find rust-version")
|
print("Couldn't find rust-version")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
versions = [match.group(1), "stable", "nightly"]
|
# versions = [match.group(1), "stable", "nightly"]
|
||||||
|
# remove this when 1.56 is released
|
||||||
|
versions = ["beta", "nightly"]
|
||||||
backends = ["xdg-mime", "infer"]
|
backends = ["xdg-mime", "infer"]
|
||||||
|
|
||||||
upto = 1
|
upto = 1
|
||||||
|
|
Loading…
Reference in a new issue