Compare commits
9 commits
88b5070a03
...
3ee8745440
Author | SHA1 | Date | |
---|---|---|---|
3ee8745440 | |||
afa2bb8784 | |||
043e0972c5 | |||
a800be63f7 | |||
bddd6caeb2 | |||
74ae55ac52 | |||
7c36061e03 | |||
4a54511833 | |||
30c7da077a |
10 changed files with 201 additions and 133 deletions
210
CHANGELOG.md
210
CHANGELOG.md
|
@ -1,113 +1,127 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
Dates are given in YYYY-MM-DD format.
|
Dates are given in YYYY-MM-DD format - for example, the 15th of October 2021 is written as 2021-10-15.
|
||||||
|
|
||||||
## v0.3
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
||||||
### v0.3.7 (2021-MM-DD)
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
#### Other
|
|
||||||
- Refactoring - split fif into main.rs and lib.rs, moved file-related functionality (directory scanning, etc.) into
|
## Unreleased
|
||||||
|
### Added
|
||||||
|
- 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
|
||||||
|
### Other
|
||||||
|
- Refactoring - split fif into `main.rs` and `lib.rs`, moved file-related functionality (directory scanning, etc.) into
|
||||||
files module, removed string module, etc.
|
files module, removed string module, etc.
|
||||||
|
- Changelog "refactoring":
|
||||||
|
- Based on the somewhat popular [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) guide, splitting the previous
|
||||||
|
"Features" heading into "Added" and "Changed" sections, renaming "Bugfixes" to "Fixed", and removing the
|
||||||
|
headings that (pointlessly?) previously divided the changelog into v0.3, v0.2, and v0.1
|
||||||
|
- A few minor grammar tweaks and reorganisations
|
||||||
|
|
||||||
### v0.3.6 (2021-08-16)
|
## v0.3.6 - 2021-08-16
|
||||||
#### Other
|
### Other
|
||||||
- Fixed another major dependency issue - [`clap`] version 3 beta 2 pulls in `clap_derive` version 3 beta **4**, causing
|
- Fixed another major dependency issue - [`clap`] version 3 beta **2** pulls in `clap_derive` version 3 beta **4**,
|
||||||
fif to fail to build unless you use `--locked`. `Cargo.toml` now explicitly depends on `clap_derive` v3b2, which should
|
causing fif to fail to build unless you use `--locked`. `Cargo.toml` now explicitly depends on `clap_derive` v3b2,
|
||||||
fix this in (hopefully) all cases...
|
which should fix this in (hopefully) all cases...
|
||||||
- Added an explicit dependency on `bitflags` 1.2.1, as 1.3+ requires Rust >= 1.46
|
- Added an explicit dependency on `bitflags` 1.2.1, as 1.3+ requires Rust >= 1.46
|
||||||
|
|
||||||
### v0.3.5 (2021-08-16) [YANKED]
|
## v0.3.5 - 2021-08-16 [YANKED]
|
||||||
#### Other
|
### Other
|
||||||
- Updated `Cargo.toml` to pin [`clap`] to version 3 beta 2 - previously, version 3 beta 4 was considered compatible and
|
- Updated `Cargo.toml` to pin [`clap`] to version 3 beta 2 - previously, version 3 beta 4 was considered compatible and
|
||||||
would be used if you ran `cargo install fif` instead of `cargo install --locked fif`, however, fif does *not* work with
|
would be used if you ran `cargo install fif` instead of `cargo install --locked fif`, however, fif does *not* work with
|
||||||
this version of `clap`, which caused the build to fail. Also, `clap` 3 beta 4 depends on Rust >= 1.54, breaking our MSRV
|
this version of `clap`, which caused the build to fail. Also, `clap` 3 beta 4 depends on Rust >= 1.54, breaking our MSRV
|
||||||
- Fixed a few other `Cargo.toml` dependency versions that were causing issues when building on MSRV
|
- Fixed a few other `Cargo.toml` dependency versions that were causing issues when building on MSRV
|
||||||
|
|
||||||
### v0.3.4 (2021-08-07)
|
## v0.3.4 - 2021-08-07
|
||||||
#### Features
|
### Added
|
||||||
- Added `-I`/`--ignore-unknown-exts` flag for ignoring files with unknown extensions - for example, if fif doesn't know
|
- `-I`/`--ignore-unknown-exts` flag for ignoring files with unknown extensions - for example, if fif doesn't know
|
||||||
what a ".fake" file is, setting this flag will prevent it from renaming "photo.fake" to "photo.jpg". This is useful
|
what a ".fake" file is, setting this flag will prevent it from renaming "photo.fake" to "photo.jpg". This is useful
|
||||||
for avoiding the case where fif incorrectly mislabels an obscure format it isn't aware of as something else.
|
for avoiding the case where fif incorrectly mislabels an obscure format it isn't aware of as something else.
|
||||||
#### Other
|
### Other
|
||||||
- Refactored `formats.rs`
|
- Refactored `formats.rs`
|
||||||
- More accurate dependency versions in `Cargo.toml` to ensure that the MSRV stays supported
|
- More accurate dependency versions in `Cargo.toml` to ensure that the MSRV stays supported
|
||||||
- Sister project (?) [`new-mime-guess`] is now v3.0.0, updated to 2018 edition Rust, and with some new file and MIME
|
- Sister project (?) [`new-mime-guess`] is now v3.0.0, updated to 2018 edition Rust, and with some new file and MIME
|
||||||
types added
|
types added
|
||||||
|
|
||||||
### v0.3.3 (2021-07-07)
|
## v0.3.3 - 2021-07-07
|
||||||
#### Features
|
### Added
|
||||||
- Added `--canonical-paths` flag for outputting canonical paths in output - for example,
|
- `--canonical-paths` flag for outputting canonical paths in output - for example,
|
||||||
`mv /home/lynne/file.jpg /home/lynne/file.mp3` instead of the default `mv file.jpg file.mp3`
|
`mv /home/lynne/file.jpg /home/lynne/file.mp3` instead of the default `mv file.jpg file.mp3`
|
||||||
#### Other
|
### Other
|
||||||
- The `FIF_LOG` environment variable can now be used to set log level, in addition to `RUST_LOG`
|
- The `FIF_LOG` environment variable can now be used to set log level, in addition to `RUST_LOG`
|
||||||
- Log output now uses abbreviated level names: For example, `[D] Message` instead of `[DEBUG] Message`
|
- Log output now uses abbreviated level names: For example, `[D] Message` instead of `[DEBUG] Message`
|
||||||
|
|
||||||
### v0.3.2 (2021-06-14)
|
## v0.3.2 - 2021-06-14
|
||||||
#### Bugfixes
|
### Changed
|
||||||
- Fixed PowerShell output regression introduced in v0.2.13, whoops
|
|
||||||
#### Other
|
|
||||||
- Nicer version output: `fif -V` reports "fif v0.3.2" (instead of just "fif 0.3.2" without the "v"), and `fif --version`
|
- Nicer version output: `fif -V` reports "fif v0.3.2" (instead of just "fif 0.3.2" without the "v"), and `fif --version`
|
||||||
reports `fif v0.3.2 (XDG-Mime backend)`, or whatever backend you're using
|
reports `fif v0.3.2 (XDG-Mime backend)`, or whatever backend you're using
|
||||||
- fif's trace output now includes its version, backend, operating system, and architecture
|
- fif's trace output now includes its version, backend, operating system, and architecture
|
||||||
|
### Fixed
|
||||||
|
- Fixed PowerShell output regression introduced in v0.2.13, whoops
|
||||||
|
### Other
|
||||||
- Block compilation if both the `xdg-mime-backend` and `infer-backend`
|
- Block compilation if both the `xdg-mime-backend` and `infer-backend`
|
||||||
[features](https://gitlab.com/Lynnesbian/fif/-/wikis/Cargo-Features) are enabled
|
[features](https://gitlab.com/Lynnesbian/fif/-/wikis/Cargo-Features) are enabled
|
||||||
|
|
||||||
### v0.3.1 (2021-06-07)
|
## v0.3.1 - 2021-06-07
|
||||||
#### Features
|
### Added
|
||||||
- Added JSON output support via `-o json`
|
- JSON output support via `-o json`
|
||||||
- Added plaintext output support via `-o text`
|
- Plaintext output support via `-o text`
|
||||||
#### Other
|
### Changed
|
||||||
- `videos` is now an alias for `video`
|
- `videos` is now an alias for `video`
|
||||||
|
### Other
|
||||||
- More extensive README documentation
|
- More extensive README documentation
|
||||||
|
|
||||||
### v0.3.0 (2021-04-28)
|
## v0.3.0 - 2021-04-28
|
||||||
#### Features
|
### Added
|
||||||
- Added `-x`/`--exclude` flag for excluding file extensions (overrides `-e` or `-E` - `-E images -x jpg` scans all image
|
- `-x`/`--exclude` flag for excluding file extensions (overrides `-e` or `-E` - `-E images -x jpg` scans all image
|
||||||
files, except ".jpg" files)
|
files, except ".jpg" files)
|
||||||
- Added `-X`/`--exclude-set` flag for excluding sets of files, with the same syntax and sets as `-E`
|
- `-X`/`--exclude-set` flag for excluding sets of files, with the same syntax and sets as `-E`
|
||||||
|
- `-q`/`--quiet` flag for reducing output verbosity
|
||||||
|
### Changed
|
||||||
|
- The `videos` extension set has been renamed to `video`, in line with `audio`. `fif --help` has actually mistakenly
|
||||||
|
referred to the set as `video` since v0.2.12! 0uo
|
||||||
- In addition to supplying included extensions as a comma separated list (like `-e jpg,png`), it is now possible to
|
- In addition to supplying included extensions as a comma separated list (like `-e jpg,png`), it is now possible to
|
||||||
supply them through multiple uses of the `-e` flag (like `-e jpg -e png`). This also applies to `-x`
|
supply them through multiple uses of the `-e` flag (like `-e jpg -e png`). This also applies to `-x`
|
||||||
- `-e` and `-E` no longer conflict with each other, and can now be used together. For example, `-E images -e mp3`
|
- `-e` and `-E` no longer conflict with each other, and can now be used together. For example, `-E images -e mp3`
|
||||||
will scan all images *and* all MP3 files
|
will scan all images *and* all MP3 files
|
||||||
- It is now possible to specify multiple extension sets at once: `-E images,system` will scan all images and archives
|
- It is now possible to specify multiple extension sets at once: `-E images,system` will scan all images and archives
|
||||||
- fif's output now includes the directory it was run from
|
- fif's output now includes the directory it was run from
|
||||||
- Added `-q`/`--quiet` flag for reducing output verbosity
|
- Changed default verbosity to `info`
|
||||||
#### Bugfixes
|
### Fixed
|
||||||
- Resolved some discrepancies between `application/xml` and `text/xml`
|
- Resolved some discrepancies between `application/xml` and `text/xml`
|
||||||
#### Other
|
### Other
|
||||||
- Published my fork of ['mime_guess'] as ['new_mime_guess'], allowing it to be used properly with
|
- Published my fork of ['mime_guess'] as ['new_mime_guess'], allowing it to be used properly with
|
||||||
[crates.io](https://crates.io)
|
[crates.io](https://crates.io)
|
||||||
- The `videos` extension set has been renamed to `video`, in line with `audio`. `fif --help` has actually mistakenly
|
|
||||||
referred to the set as `video` since v0.2.12! 0uo
|
|
||||||
- CI has been vastly improved
|
- CI has been vastly improved
|
||||||
- Changed default verbosity to `info`
|
|
||||||
|
|
||||||
## v0.2
|
## v0.2
|
||||||
### v0.2.13 (2021-04-26)
|
### v0.2.13 (2021-04-26)
|
||||||
#### Features
|
### Added
|
||||||
- Added `-v`/`--verbose` flag for setting verbosity without using `RUST_LOG`
|
- `-v`/`--verbose` flag for setting verbosity without using `RUST_LOG`
|
||||||
- Added system extension set (`.dll`, `.so`, `.exe`...)
|
- System extension set (`.dll`, `.so`, `.exe`...)
|
||||||
|
- [`infer`] backend now supports Ren'Py archive (`.rpa`) files
|
||||||
|
### Changed
|
||||||
- Output is now sorted: Files that couldn't be read, then files with no known mimetype, then files with no known
|
- Output is now sorted: Files that couldn't be read, then files with no known mimetype, then files with no known
|
||||||
extensions, then files with the wrong extension
|
extensions, then files with the wrong extension
|
||||||
#### Bugfixes
|
- Added Apple iWork document formats to Documents extension set (`.pages`, `.key`, `.numbers`)
|
||||||
|
### Fixed
|
||||||
- Fixed some bad formatting in PowerShell output
|
- Fixed some bad formatting in PowerShell output
|
||||||
- Always quote file paths in output, even when not necessary - This makes output more portable and less likely to break
|
- Always quote file paths in output, even when not necessary - This makes output more portable and less likely to break
|
||||||
in future, or if [`snailquote`] misses something
|
in future, or if [`snailquote`] misses something
|
||||||
#### Other
|
### Other
|
||||||
- Added Apple iWork document formats to documents extension set
|
|
||||||
- Cleaned up and properly documented tests
|
- Cleaned up and properly documented tests
|
||||||
- Renamed `Script` (in `formats.rs`) to `Shell`, in line with renaming in `parameters.rs`
|
- Renamed `Script` (in `formats.rs`) to `Shell`, in line with renaming in `parameters.rs`
|
||||||
- Added .rpa (Ren'Py archive) support to infer backend
|
|
||||||
- [`xdg-mime`] no longer uses git version
|
- [`xdg-mime`] no longer uses git version
|
||||||
- Output `\r\n` on Windows
|
- Output `\r\n` on Windows
|
||||||
- Use a macro to generate `Writable` arrays, making the code a little cleaner and nicer to write
|
- Use a macro to generate `Writable` arrays, making the code a little cleaner and nicer to write
|
||||||
|
|
||||||
### v0.2.12 (2021-04-14)
|
### v0.2.12 (2021-04-14)
|
||||||
#### Features
|
### Added
|
||||||
- Added Text extension set
|
- Text extension set
|
||||||
- Better documentation for command line arguments
|
- Better documentation for command line arguments
|
||||||
#### Bugfixes
|
### Fixed
|
||||||
- Fixed a very minor output bug relating to scanning symlinked directories
|
- Fixed a very minor output bug relating to scanning symlinked directories
|
||||||
- Better detection for pre-OOXML Office files
|
- Better detection for pre-OOXML Office files
|
||||||
#### Other
|
### Other
|
||||||
- Much better README.md
|
- Much better README.md
|
||||||
- Added more stuff to test.py
|
- Added more stuff to test.py
|
||||||
- PKGBUILD for Arch-based distros
|
- PKGBUILD for Arch-based distros
|
||||||
|
@ -115,103 +129,115 @@ this version of `clap`, which caused the build to fail. Also, `clap` 3 beta 4 de
|
||||||
- Doubled BUF_SIZE
|
- Doubled BUF_SIZE
|
||||||
|
|
||||||
### v0.2.11 (2021-04-04)
|
### v0.2.11 (2021-04-04)
|
||||||
#### Features
|
### Added
|
||||||
- fif can now traverse symlinks with the `-f`/`--follow-symlinks` flag
|
- fif can now traverse symlinks with the `-f`/`--follow-symlinks` flag
|
||||||
|
### Changed
|
||||||
|
- Better mime type detection:
|
||||||
|
- Consider "some/x-thing" and "some/thing" to be identical
|
||||||
|
- Use a patched version of mime_guess (which took a while to make 0u0;) with many more extension/type mappings
|
||||||
- Extensions are no longer mandatory - running fif without `-e` or `-E` will scan all files, regardless of extension
|
- Extensions are no longer mandatory - running fif without `-e` or `-E` will scan all files, regardless of extension
|
||||||
(files without extensions are still skipped unless the -S flag is used)
|
(files without extensions are still skipped unless the -S flag is used)
|
||||||
#### Bugfixes
|
### Fixed
|
||||||
- Fixed compilation on big endian 32-bit architectures (see
|
- Fixed compilation on big endian 32-bit architectures (see
|
||||||
[here](https://github.com/bodil/smartstring/blob/v0.2.7/src/config.rs#L102-L104) for why that was a problem in the
|
[here](https://github.com/bodil/smartstring/blob/v0.2.7/src/config.rs#L102-L104) for why that was a problem in the
|
||||||
first place)
|
first place)
|
||||||
- Fixed broken tests for the [`infer`] backend
|
- Fixed broken tests for the [`infer`] backend
|
||||||
#### Other
|
|
||||||
- Better mime type detection:
|
|
||||||
- Consider "some/x-thing" and "some/thing" to be identical
|
|
||||||
- Use a patched version of mime_guess (which took a while to make 0u0;) with many more extension/type mappings
|
|
||||||
|
|
||||||
### v0.2.10 (2021-03-26)
|
### v0.2.10 (2021-03-26)
|
||||||
|
### Added
|
||||||
- PowerShell support!
|
- PowerShell support!
|
||||||
|
|
||||||
### v0.2.9 (2021-03-17)
|
## v0.2.9 - 2021-03-17
|
||||||
|
### Other
|
||||||
- Replaced a bunch of `PathBuf`s with `Path`s, which should reduce memory usage
|
- Replaced a bunch of `PathBuf`s with `Path`s, which should reduce memory usage
|
||||||
- Formatting improvements
|
- Formatting improvements
|
||||||
|
|
||||||
### v0.2.8 (2021-03-03)
|
## v0.2.8 - 2021-03-03
|
||||||
#### Features
|
### Added
|
||||||
- Added much more information - author, copyright, etc. - to `--help`/`-h` output
|
- Much more information to help output: author, copyright, etc.
|
||||||
- Scan files without extensions with `-S` (by default, such files are ignored)
|
- Scan files without extensions with `-S` (by default, such files are ignored)
|
||||||
#### Bugfixes
|
### Fixed
|
||||||
- Using `-s` to skip hidden files no longer skips all files if the root directory itself is hidden
|
- Using `-s` to skip hidden files no longer skips all files if the root directory itself is hidden
|
||||||
#### Other
|
### Other
|
||||||
- The `ScanError` enum now contains a `PathBuf` - Errors now return `ScanError` rather than `(ScanError, PathBuf)`
|
- The `ScanError` enum now contains a `PathBuf` - Errors now return `ScanError` rather than `(ScanError, PathBuf)`
|
||||||
- Renamed modules in accordance with [Rust's API guidelines](https://rust-lang.github.io/api-guidelines/naming.html)
|
- Renamed modules in accordance with [Rust's API guidelines](https://rust-lang.github.io/api-guidelines/naming.html)
|
||||||
|
|
||||||
### v0.2.7 (2021-03-01)
|
## v0.2.7 - 2021-03-01
|
||||||
- Default to `WARN`-level logging if `RUST_LOG` isn't set
|
### Added
|
||||||
- Added a drone CI config
|
|
||||||
- Added `test.py` for automated building and testing against Rust stable, beta, nightly, and the MSRV specified in
|
|
||||||
`Cargo.toml`
|
|
||||||
- Added a test for argument parsing
|
|
||||||
- Documentation! And lots of it! 0u0
|
- Documentation! And lots of it! 0u0
|
||||||
|
- Added a test for argument parsing
|
||||||
|
### Changed
|
||||||
|
- Default to `WARN`-level logging if `RUST_LOG` isn't set
|
||||||
|
|
||||||
### v0.2.6 (2021-02-28)
|
### Other
|
||||||
- Added tests!
|
- Drone CI config
|
||||||
|
- `test.py` for automated building and testing against Rust stable, beta, nightly, and the MSRV specified in
|
||||||
|
`Cargo.toml`
|
||||||
|
|
||||||
|
## v0.2.6 - 2021-02-28
|
||||||
|
### Added
|
||||||
|
- Tests!
|
||||||
|
### Changed
|
||||||
- Default to [`xdg-mime`] on all Unixy platforms, not just Linux - this also includes the various *BSDs (I've tested
|
- Default to [`xdg-mime`] on all Unixy platforms, not just Linux - this also includes the various *BSDs (I've tested
|
||||||
FreeBSD), macOS (haven't tested, but I have a very old MacBook running Leopard that has `file` preinstalled, so it
|
FreeBSD), macOS (haven't tested, but I have a very old MacBook running Leopard that has `file` preinstalled, so it
|
||||||
*should* work fine), Redox OS (haven't tested), etc.
|
*should* work fine), Redox OS (haven't tested), etc.
|
||||||
|
|
||||||
### v0.2.5 (2021-02-27)
|
## v0.2.5 - 2021-02-27
|
||||||
|
### Other
|
||||||
- Use [`xdg-mime`] by default on Linux, [`infer`] elsewhere
|
- Use [`xdg-mime`] by default on Linux, [`infer`] elsewhere
|
||||||
|
|
||||||
### v0.2.4 (2021-02-22)
|
## v0.2.4 - 2021-02-22
|
||||||
|
### Added
|
||||||
- Proper(ish) XML document support
|
- Proper(ish) XML document support
|
||||||
- Display version in help output
|
- Display version in help output
|
||||||
|
|
||||||
### v0.2.3+hotfix (2021-02-22)
|
### v0.2.3+hotfix (2021-02-22)
|
||||||
|
### Added
|
||||||
- A quick hack to fix broken/non-existent support for XML document files - `docx`, `odt`, etc.
|
- A quick hack to fix broken/non-existent support for XML document files - `docx`, `odt`, etc.
|
||||||
|
|
||||||
### v0.2.3 (2021-02-22)
|
## v0.2.3 - 2021-02-22
|
||||||
#### Features
|
### Added
|
||||||
- Automatically disable [`xdg-mime`] backend on Windows
|
- Automatically disable [`xdg-mime`] backend on Windows
|
||||||
- Exit codes
|
- Exit codes
|
||||||
- Improved error handling
|
- Improved error handling
|
||||||
- Retrieve extension sets from [`mime_guess`] rather than hardcoding them
|
- Retrieve extension sets from [`mime_guess`] rather than hardcoding them
|
||||||
#### Bugfixes
|
### Changed
|
||||||
- Improved SVG detection
|
|
||||||
#### Other
|
|
||||||
- Switched back from `printf` to `echo` in shell output
|
- Switched back from `printf` to `echo` in shell output
|
||||||
|
### Fixed
|
||||||
|
- Improved SVG detection
|
||||||
|
### Other
|
||||||
- More frequent and detailed comments
|
- More frequent and detailed comments
|
||||||
- Refactored `formats.rs`
|
- Refactored `formats.rs`
|
||||||
- Exclude certain files and directories from the crate
|
- Exclude certain files and directories from the crate
|
||||||
|
|
||||||
### v0.2.2 (2021-02-20)
|
## v0.2.2 - 2021-02-20
|
||||||
|
### Added
|
||||||
- Windows support
|
- Windows support
|
||||||
|
|
||||||
### v0.2.1 (2021-02-18)
|
## v0.2.1 - 2021-02-18
|
||||||
#### Features
|
### Added
|
||||||
- Added extension sets -- you can now use, for example, `-E images` to check files with known image extensions
|
- Extension sets -- you can now use, for example, `-E images` to check files with known image extensions
|
||||||
- Shell script output now uses `printf` instead of `echo`
|
- Shell script output now uses `printf` instead of `echo`
|
||||||
- Added [`infer`] backend, configurable with [Cargo features](https://gitlab.com/Lynnesbian/fif/-/wikis/Cargo-Features)
|
- [`infer`] backend, configurable with [Cargo features](https://gitlab.com/Lynnesbian/fif/-/wikis/Cargo-Features)
|
||||||
#### Bugfixes
|
### Fixed
|
||||||
- Fixed broken singlethreaded support
|
- Fixed broken singlethreaded support
|
||||||
#### Other
|
### Other
|
||||||
- Use a global backend instance instead of passing `&db` around constantly
|
- Use a global backend instance instead of passing `&db` around constantly
|
||||||
- Use `rustfmt` 0u0
|
- Use `rustfmt` 0u0
|
||||||
|
|
||||||
### v0.2.0 (2021-02-15)
|
## v0.2.0 - 2021-02-15
|
||||||
#### Features
|
### Added
|
||||||
- Output a script rather than a list of misnamed files
|
- Output a script rather than a list of misnamed files
|
||||||
- Parallel file scanning
|
- Parallel file scanning
|
||||||
- Added logging support
|
- Logging support
|
||||||
#### Bugfixes
|
### Fixed
|
||||||
- Handle filenames with invalid UTF-8
|
- Handle filenames with invalid UTF-8
|
||||||
#### Other
|
### Other
|
||||||
- Added license
|
- Now licensed (under GPLv3)
|
||||||
- Replaced [`structopt`] with [`clap`] 3 (beta)
|
- Replaced [`structopt`] with [`clap`] 3 (beta)
|
||||||
- Specify 1.43.0 as minimum supported Rust version
|
- Specify 1.43.0 as minimum supported Rust version
|
||||||
|
|
||||||
## v0.1
|
## v0.1.0 - 2021-02-04
|
||||||
### v0.1.0 (2021-02-04)
|
|
||||||
Initial commit!
|
Initial commit!
|
||||||
- Only one backend - [`xdg-mime`]
|
- Only one backend - [`xdg-mime`]
|
||||||
- No output formats - just prints a list of files to be renamed
|
- No output formats - just prints a list of files to be renamed
|
||||||
|
|
28
Cargo.lock
generated
28
Cargo.lock
generated
|
@ -311,9 +311,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.101"
|
version = "0.2.102"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21"
|
checksum = "a2a5ac8f984bfcf3a823267e5fde638acc3325f6496633a5da6bb6eb2171e103"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
|
@ -613,9 +613,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.67"
|
version = "1.0.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a7f9e390c27c3c0ce8bc5d725f6e4d30a29d26659494aa4b17535f7522c5c950"
|
checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"ryu",
|
"ryu",
|
||||||
|
@ -624,9 +624,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "siphasher"
|
name = "siphasher"
|
||||||
version = "0.3.6"
|
version = "0.3.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "729a25c17d72b06c68cb47955d44fda88ad2d3e7d77e025663fdd69b93dd71a1"
|
checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smartstring"
|
name = "smartstring"
|
||||||
|
@ -655,9 +655,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.75"
|
version = "1.0.76"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7"
|
checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -709,18 +709,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.28"
|
version = "1.0.29"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "283d5230e63df9608ac7d9691adc1dfb6e701225436eb64d0b9a7f0a5a04f6ec"
|
checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.28"
|
version = "1.0.29"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fa3884228611f5cd3608e2d409bf7dce832e4eb3135e3f11addbd7e41bd68e71"
|
checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -744,9 +744,9 @@ checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.8"
|
version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
|
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
|
|
|
@ -92,3 +92,6 @@ opt-level = 3
|
||||||
|
|
||||||
[profile.test.package."*"]
|
[profile.test.package."*"]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
|
||||||
|
[package.metadata]
|
||||||
|
msrv = "1.43.0"
|
18
build.rs
18
build.rs
|
@ -1,3 +1,5 @@
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
#[allow(unreachable_code, clippy::pedantic)]
|
#[allow(unreachable_code, clippy::pedantic)]
|
||||||
fn main() -> Result<(), String> {
|
fn main() -> Result<(), String> {
|
||||||
#[cfg(all(feature = "infer-backend", feature = "xdg-mime-backend"))]
|
#[cfg(all(feature = "infer-backend", feature = "xdg-mime-backend"))]
|
||||||
|
@ -6,5 +8,21 @@ fn main() -> Result<(), String> {
|
||||||
"fif cannot be compiled with multiple backends set - please enable only one, or use the default.",
|
"fif cannot be compiled with multiple backends set - please enable only one, or use the default.",
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// a more robust way of doing this would be to use vergen (https://github.com/rustyhorde/vergen), but it pulls in a
|
||||||
|
// whole bunch of extra dependencies (including chrono and git2), and also blocks compilation on the current MSRV.
|
||||||
|
// this method is less clever and robust, but it works!
|
||||||
|
let git = Command::new("git").args(&["rev-parse", "--short", "HEAD"]).output();
|
||||||
|
let hash = match git {
|
||||||
|
Ok(output) => String::from_utf8_lossy(&*output.stdout).into(),
|
||||||
|
Err(_) => {
|
||||||
|
// git not being present (or failing) shouldn't block compilation
|
||||||
|
println!("cargo:warning=Failed to retrieve git commit hash");
|
||||||
|
String::from("???")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
println!("cargo:rustc-env=GIT_SHA={}", hash);
|
||||||
|
println!("cargo:rustc-rerun-if-changed=.git/HEAD");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,13 @@ use std::os::unix::ffi::OsStrExt;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
|
use itertools::{Either, Itertools};
|
||||||
use snailquote::escape;
|
use snailquote::escape;
|
||||||
|
|
||||||
use crate::findings::ScanError;
|
use crate::findings::ScanError;
|
||||||
use crate::utils::clap_long_version;
|
use crate::utils::clap_long_version;
|
||||||
use crate::Findings;
|
use crate::Findings;
|
||||||
use itertools::{Either, Itertools};
|
use crate::String;
|
||||||
|
|
||||||
/// A macro for creating an array of `Writable`s without needing to pepper your code with `into()`s.
|
/// A macro for creating an array of `Writable`s without needing to pepper your code with `into()`s.
|
||||||
/// # Usage
|
/// # Usage
|
||||||
|
@ -73,7 +74,7 @@ impl<'a> From<&'a OsStr> for Writable<'a> {
|
||||||
fn from(p: &'a OsStr) -> Writable<'a> { Writable::Path(p.as_ref()) }
|
fn from(p: &'a OsStr) -> Writable<'a> { Writable::Path(p.as_ref()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generated_by() -> String { format!("Generated by fif {}", clap_long_version()) }
|
fn generated_by() -> String { format!("Generated by fif {}", clap_long_version()).into() }
|
||||||
|
|
||||||
pub fn smart_write<W: Write>(f: &mut W, writeables: &[Writable]) -> io::Result<()> {
|
pub fn smart_write<W: Write>(f: &mut W, writeables: &[Writable]) -> io::Result<()> {
|
||||||
// ehhhh
|
// ehhhh
|
||||||
|
@ -121,14 +122,13 @@ pub fn smart_write<W: Write>(f: &mut W, writeables: &[Writable]) -> io::Result<(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait FormatSteps {
|
pub trait FormatSteps {
|
||||||
fn rename<W: Write>(&self, _f: &mut W, _from: &Path, _to: &Path) -> io::Result<()> { unreachable!() }
|
fn rename<W: Write>(&self, _f: &mut W, _from: &Path, _to: &Path) -> io::Result<()>;
|
||||||
fn no_known_extension<W: Write>(&self, _f: &mut W, _path: &Path) -> io::Result<()> { unreachable!() }
|
fn no_known_extension<W: Write>(&self, _f: &mut W, _path: &Path) -> io::Result<()>;
|
||||||
fn unreadable<W: Write>(&self, _f: &mut W, _path: &Path) -> io::Result<()> { unreachable!() }
|
fn unreadable<W: Write>(&self, _f: &mut W, _path: &Path) -> io::Result<()>;
|
||||||
fn unknown_type<W: Write>(&self, _f: &mut W, _path: &Path) -> io::Result<()> { unreachable!() }
|
fn unknown_type<W: Write>(&self, _f: &mut W, _path: &Path) -> io::Result<()>;
|
||||||
fn header<W: Write>(&self, _f: &mut W, _entries: &Entries) -> io::Result<()> { unreachable!() }
|
fn header<W: Write>(&self, _f: &mut W, _entries: &Entries) -> io::Result<()>;
|
||||||
fn footer<W: Write>(&self, _f: &mut W, _entries: &Entries) -> io::Result<()> { unreachable!() }
|
fn footer<W: Write>(&self, _f: &mut W, _entries: &Entries) -> io::Result<()>;
|
||||||
fn write_steps<W: Write>(&self, f: &mut W, entries: &Entries) -> io::Result<()> {
|
fn write_steps<W: Write>(&self, f: &mut W, entries: &Entries) -> io::Result<()> {
|
||||||
// TODO: clean this up - it's kinda messy
|
|
||||||
self.header(f, entries)?;
|
self.header(f, entries)?;
|
||||||
|
|
||||||
// output will be generated in the order:
|
// output will be generated in the order:
|
||||||
|
|
|
@ -43,9 +43,23 @@ cfg_if! {
|
||||||
buf.len() >= 34 && buf.starts_with(b"RPA-") && buf[7] == b' ' && buf[24] ==b' '
|
buf.len() >= 34 && buf.starts_with(b"RPA-") && buf[7] == b' ' && buf[24] ==b' '
|
||||||
});
|
});
|
||||||
|
|
||||||
|
info.add("audio/x-aiff", "aiff", |buf| {
|
||||||
|
// as added by https://github.com/bojand/infer/pull/48/files
|
||||||
|
// this should be removed when (if) that PR is accepted
|
||||||
|
buf.len() > 11
|
||||||
|
&& buf[0] == 0x46
|
||||||
|
&& buf[1] == 0x4F
|
||||||
|
&& buf[2] == 0x52
|
||||||
|
&& buf[3] == 0x4D
|
||||||
|
&& buf[8] == 0x41
|
||||||
|
&& buf[9] == 0x49
|
||||||
|
&& buf[10] == 0x46
|
||||||
|
&& buf[11] == 0x46
|
||||||
|
});
|
||||||
|
|
||||||
info.add("image/svg+xml", "svg", |buf| {
|
info.add("image/svg+xml", "svg", |buf| {
|
||||||
// before doing the moderately expensive SVG check, we should make sure that the input is actually SGML-ish
|
// before doing the moderately expensive SVG check, we should make sure that the input is actually SGML-ish,
|
||||||
// by "SGML-ish", i mean starts with anywhere from zero to ∞-1 whitespace characters, and then a less than sign,
|
// by which i mean, starts with anywhere from zero to ∞-1 whitespace characters, and then a less than sign,
|
||||||
// and then there's some other stuff we don't care about right now
|
// and then there's some other stuff we don't care about right now
|
||||||
|
|
||||||
// so, here comes our fancy pants """""SGML-ish validator"""""
|
// so, here comes our fancy pants """""SGML-ish validator"""""
|
||||||
|
@ -72,9 +86,6 @@ cfg_if! {
|
||||||
.any(|buf| identifiers.iter().any(|id| buf.starts_with(id)))
|
.any(|buf| identifiers.iter().any(|id| buf.starts_with(id)))
|
||||||
});
|
});
|
||||||
|
|
||||||
// unmut
|
|
||||||
let info = info;
|
|
||||||
|
|
||||||
Self { db: info }
|
Self { db: info }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ pub enum OutputFormat {
|
||||||
Json,
|
Json,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: convert this to macro style?: https://docs.rs/clap/3.0.0-beta.2/clap/index.html#using-macros
|
|
||||||
|
|
||||||
#[derive(Clap, Debug)]
|
#[derive(Clap, Debug)]
|
||||||
#[allow(clippy::struct_excessive_bools)]
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
#[clap(
|
#[clap(
|
||||||
|
|
|
@ -474,4 +474,6 @@ fn validate_string_type() {
|
||||||
SmartString::from("A long and therefore heap-allocated string"),
|
SmartString::from("A long and therefore heap-allocated string"),
|
||||||
StdString::from("A long and therefore heap-allocated string")
|
StdString::from("A long and therefore heap-allocated string")
|
||||||
);
|
);
|
||||||
|
// uncomment if i ever update to smartstring >= 0.2.9
|
||||||
|
// smartstring::validate();
|
||||||
}
|
}
|
||||||
|
|
26
src/utils.rs
26
src/utils.rs
|
@ -1,6 +1,8 @@
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
|
|
||||||
|
use crate::String;
|
||||||
|
|
||||||
/// The current version of fif, as defined in Cargo.toml.
|
/// The current version of fif, as defined in Cargo.toml.
|
||||||
pub const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
|
pub const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
|
@ -22,29 +24,37 @@ static CLAP_VERSION: OnceCell<String> = OnceCell::new();
|
||||||
static CLAP_LONG_VERSION: OnceCell<String> = OnceCell::new();
|
static CLAP_LONG_VERSION: OnceCell<String> = OnceCell::new();
|
||||||
|
|
||||||
/// Sets [`CLAP_VERSION`] to be the version defined in Cargo.toml, prefixed with a v (e.g. "v0.3.1"), then returns it as
|
/// Sets [`CLAP_VERSION`] to be the version defined in Cargo.toml, prefixed with a v (e.g. "v0.3.1"), then returns it as
|
||||||
/// a String.
|
/// an str.
|
||||||
pub fn clap_version() -> &'static str { CLAP_VERSION.get_or_init(|| String::from("v") + VERSION.unwrap_or("???")) }
|
pub fn clap_version() -> &'static str { CLAP_VERSION.get_or_init(|| String::from("v") + VERSION.unwrap_or("???")) }
|
||||||
|
|
||||||
/// Sets [`CLAP_LONG_VERSION`] to be similar to [`CLAP_VERSION`], followed by the chosen backend in parentheses (e.g.
|
/// Sets [`CLAP_LONG_VERSION`] to be similar to [`CLAP_VERSION`], followed by the chosen backend and abbreviated git
|
||||||
/// "v0.3.1 (XDG-Mime backend)"), then returns it as a String.
|
/// commit hash in parentheses (e.g. "v0.3.6 (XDG-Mime backend, commit #043e097)"), then returns it as an str.
|
||||||
pub fn clap_long_version() -> &'static str {
|
pub fn clap_long_version() -> &'static str {
|
||||||
CLAP_LONG_VERSION.get_or_init(|| format!("v{} ({} backend)", VERSION.unwrap_or("???"), BACKEND))
|
CLAP_LONG_VERSION.get_or_init(|| {
|
||||||
|
format!(
|
||||||
|
"v{} ({} backend, commit #{})",
|
||||||
|
VERSION.unwrap_or("???"),
|
||||||
|
BACKEND,
|
||||||
|
option_env!("GIT_SHA").unwrap_or("???")
|
||||||
|
)
|
||||||
|
.into()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the name of the target operating system with proper casing, like "Windows" or "macOS".
|
/// Returns the name of the target operating system with proper casing, like "Windows" or "macOS".
|
||||||
#[allow(clippy::option_map_unit_fn)]
|
#[allow(clippy::option_map_unit_fn)]
|
||||||
pub fn os_name() -> String {
|
pub fn os_name() -> String {
|
||||||
use std::env::consts::OS;
|
match std::env::consts::OS {
|
||||||
match OS {
|
// special cases: "ios" should not be capitalised into "Ios", for example
|
||||||
"ios" => "iOS".into(),
|
"ios" => "iOS".into(),
|
||||||
"macos" => "macOS".into(),
|
"macos" => "macOS".into(),
|
||||||
"freebsd" => "FreeBSD".into(),
|
"freebsd" => "FreeBSD".into(),
|
||||||
"openbsd" => "OpenBSD".into(),
|
"openbsd" => "OpenBSD".into(),
|
||||||
"netbsd" => "NetBSD".into(),
|
"netbsd" => "NetBSD".into(),
|
||||||
"vxworks" => "VxWorks".into(),
|
"vxworks" => "VxWorks".into(),
|
||||||
_ => {
|
os => {
|
||||||
// generic case: return consts::OS with the first letter in uppercase ("linux" -> "Linux")
|
// generic case: return consts::OS with the first letter in uppercase ("linux" -> "Linux")
|
||||||
let mut os_upper = String::from(OS);
|
let mut os_upper = String::from(os);
|
||||||
os_upper.get_mut(0..1).map(|first| first.make_ascii_uppercase());
|
os_upper.get_mut(0..1).map(|first| first.make_ascii_uppercase());
|
||||||
os_upper
|
os_upper
|
||||||
}
|
}
|
||||||
|
|
6
test.py
6
test.py
|
@ -11,7 +11,7 @@ def test_archs():
|
||||||
|
|
||||||
for arch in archs:
|
for arch in archs:
|
||||||
print(f"Testing {arch} ({upto} of {target})")
|
print(f"Testing {arch} ({upto} of {target})")
|
||||||
subprocess.run(f"cross test --features=infer-backend --target {arch}-unknown-linux-gnu".split(" ")).check_returncode()
|
subprocess.run(f"cross test --features=json,infer-backend --target {arch}-unknown-linux-gnu".split(" ")).check_returncode()
|
||||||
upto += 1
|
upto += 1
|
||||||
|
|
||||||
def test_versions():
|
def test_versions():
|
||||||
|
@ -33,11 +33,11 @@ def test_versions():
|
||||||
for version in versions:
|
for version in versions:
|
||||||
for backend in backends:
|
for backend in backends:
|
||||||
print(f"[{version}, {backend}] Tests ({upto} of {target})")
|
print(f"[{version}, {backend}] Tests ({upto} of {target})")
|
||||||
subprocess.run(f"cargo +{version} test --features={backend}-backend".split(" ")).check_returncode()
|
subprocess.run(f"cargo +{version} test --features=json,{backend}-backend".split(" ")).check_returncode()
|
||||||
upto += 1
|
upto += 1
|
||||||
|
|
||||||
print(f"[{version}, {backend}] Scanning imgs ({upto} of {target})")
|
print(f"[{version}, {backend}] Scanning imgs ({upto} of {target})")
|
||||||
subprocess.run(f"cargo +{version} run --release --features={backend}-backend -- imgs".split(" ")).check_returncode()
|
subprocess.run(f"cargo +{version} run --release --features=json,{backend}-backend -- imgs".split(" ")).check_returncode()
|
||||||
upto += 1
|
upto += 1
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Reference in a new issue