Instead of checking if `options.quiet` is set whenever printing, disable
all printing to stderr if the `--quiet` flag is passed.
Although it isn't strictly necessary, I still don't construct a progress
bar if `options.quiet` is true, since progress bars might be a little
more expensive than just printing error messages.
A future diff might add checking to the `errln` and `outln` macros, so
that they don't print at all if the respective output stream is
inactive.
type: reform
`Info::infohash` will discard fields not present in the `Info` struct,
and can thus produce an erronous infohash.
To try to prevent this function from being called in those
circumstances, rename it to `Info::infohash_lossy`, and add a comment
explaining why it is dangerous.
Embarassingly, `Info::infohash` was called in
`TorrentSummary::from_input`, and thus transitively by the torrent show
subcommand, where it is definitely not safe, since torrent show is
intended to be used with arbitrary torrents. This is now fixed.
There was also a build failure caused by a cache issue, so change the
cache keys to invalidate the caches.
type: fixed
- Add a `bench` feature that exposes a hasher benchmark.
- Make the hasher read up to the next piece end and hash everything it
reads, instead of hashing one byte at a time. This was a 4x
improvement on the benchmark. (Terrible code == easy wins!)
type: performance
Split imdl into a binary, `src/main.rs`, and a library, `src/lib.rs`.
This will enable benchmarking, fuzz testing, and anything that requires
making `imdl` functions accessible another crate.
type: reform
- Combine test Metainfo values into a small number of globally available
values.
- Serialize update URLs as `URL` insted of `String`.
- Add additional `show` tests
type: reform
Input can now be passed to `imdl torrent show` without a flag:
imdl torrent show foo.torrent
Passing input by flag continues to work.
type: changed
fixes:
- https://github.com/casey/intermodal/issues/375
The shell can now be passed to `imdl completions` without a flag:
imdl completions bash
Passing the shell by flag continues to work.
type: changed
fixes:
- https://github.com/casey/intermodal/issues/375
Input can now be passed to `imdl torrent verify` without a flag:
imdl torrent verify foo.torrent
Passing input by flag continues to work.
type: changed
fixes:
- https://github.com/casey/intermodal/issues/375
Allow taking the `--input` argument to `imdl torrent create` as a
positional argument, so the following now works:
imdl torrent create foo
Taking input by flag `--input` still works.
type: changed
fixes:
- https://github.com/casey/intermodal/issues/375
Add a global flag `--quiet`, which allows supressing output from
`imdl torrent create` and `imdl torrent verify`.
Since it's a global option, it should be given before the subcommand,
e.g.:
imdl --quiet torrent create --input .
type: added
fixes:
- https://github.com/casey/intermodal/issues/174
Add a '--ignore' flag that, when passed, causes `imdl torretn create` to
skip files listed in `.gitignore`, `.ignore`, `.git/info/exclude`, and
`git config --get core.excludesFile`.
Also switches from the `walkdir` crate to the `ignore` crate, which uses
`walkdir` internally, and which handles `.gitignore` and `.ignore`
files.
This changes the behavior of `-include-hidden` on MacOS to no longer
skip entries with the hidden attribute set, due to `ignore` not exposing
`walkdir`'s filter functionality.
A PR[0] is pending to add filtering to `ignore`, so hopefully this
functionality can be re-implemented soon.
[0] https://github.com/BurntSushi/ripgrep/pull/1557
type: added
fixes:
- https://github.com/casey/intermodal/issues/378
The `--terminal` flag can be used to override terminal autodetection and
force `imdl` to behave as if standard error and standard output are
connected to a terminal.
type: added
fixes:
- https://github.com/casey/intermodal/issues/398
Add the `Invariant` trait, which provides `Invariant::invariant` and
`Invariant::invariant_unwrap` methods, and use them instead of unwrap
and expect.
I think these methods are a bit clearer than `unwrap` and `expect`,
since they more clearly document intent, i.e. that the thing passed to
`invariant` should be a description of an invariant that should always
be true, and should provide better error messages.
Replace uses of `unwrap` and `expect` with `invariant`.
type: reform
fixes:
- https://github.com/casey/intermodal/issues/167
Since getting the system time is fallible, do it early when creating a
torrent, so as to avoid potentially wasting time searching and hashing.
type: reform
fixes:
- https://github.com/casey/intermodal/issues/207
This enables `--select-only 1,2,3` which gets appended to the magnet
link as `&so=1,2,3`.
It's a partial implementation because we're missing support for file
ranges ie `--select-only 4-6`
type: added
fixes:
- https://github.com/casey/intermodal/issues/245
The clap-generated zsh completion scripts use unescaped double-quoted
strings for the subocommand description text, which causes backtick
characters to be evaluated.
Remove backticks from the subcommand descriptions, to un-break the zsh
completion scripts.
type: fixed
pr: https://github.com/casey/intermodal/pull/365
The command `--help` text output in the book was very wide, which caused
it to be clipped and require scrolling horizontally to see it all.
This diff renders the text at 80 columns, which makes it visible without
scrolling at reasonable screen sizes.
To do this, `env::run` now checks for the presence of the environment
variable `IMDL_TERM_WIDTH`, which, if set to a positive integer, will be
passed to `Clap::set_term_width`.
`bin/man` now uses this to render the help text at 80 characters.
type: documentation
pr: https://github.com/casey/intermodal/pull/364
Use the `wide_bar` indicatif format specifier to truncate the progress
bar when the terminal is narrow. This prevents the progress bar from
printing mulitple times when the terminal is narrow
type: fixed
pr: https://github.com/casey/intermodal/pull/353
If a user passes `--input foo`, print "Searching `foo` for files…",
instead of the resolved, absolute path to `foo`, since the former is
what the user typed in.
This was way harder, and had way more edge cases, than I thought it would
be!
One takaway, lexical path cleaning is excellent.
type: changed
fixes:
- https://github.com/casey/intermodal/issues/252
- https://github.com/casey/intermodal/issues/332
When an empty path is passed to `Env::resolve`, the result is the
current working directory. This is bad, so forbid the user to pass in
empty paths.
type: fixed
Torrents may now be created from standard input by passing `--input -`.
Since `--name` and `--output` cannot be deduced, they are required when
`--input -`.
type: added
Shell completion scripts can be generated for `bash`, `elvish`, `fish`,
`powershell`, and `zsh` with the `completions` subcommand:
$ imdl completions --shell zsh > imdl.zsh
The same scripts are available in the `completions` directory. Please
refer to your shell's documentation for more information on how to
install and use completion scripts.
type: added
Sort specs are of the form `KEY:ORDER`, and allow sorting files in a
torrent by multiple criteria. Multiple sort specs can be passed with
`--sort-by` upon torrent creation.
type: added
The order in which files appear in torrents can now be controlled
with the `--order` flag:
imdl torrent create --input foo --order alphabetical-asc
See `--help` documentation for possible values.
type: added
- Trigger GitHub Actions workflow on release tags
- Make build script tolerate not being called in git directory
- Omit git hash in created by message if not built in git directory
- Test created by message format
type: distribution