Commit Graph
223 Commits
Author SHA1 Message Date
Gabriel Arazas 15dc96a946 Add installation instructions for Guix 2020-11-25 12:18:16 +01:00
sharkdp 6b2cc80cc1 Change ASCII file to contain increasing hex digits 2020-11-01 22:56:59 +01:00
sharkdp 1db77094da Organize integration tests into modules 2020-11-01 22:56:59 +01:00
sharkdp 8c3f2230c6 Better error message when seek fails
> hexyl "$(which hexyl)" --skip=-5gib
    Error: Failed to jump to the desired input position. This could be
    caused by a negative offset that is too large or by an input that is not
    seek-able (e.g. if the input comes from a pipe).

ref: #114
2020-11-01 22:56:59 +01:00
sharkdp 66f8508b57 Add stdin test 2020-11-01 21:35:35 +01:00
sharkdp afb249e854 Run cargo fmt 2020-11-01 21:04:39 +01:00
sharkdp 9432677d3a Disallow block sizes of 0
closes #110
2020-10-31 10:17:19 +01:00
Tom Milligan 524a6c607f bin: offset should add to skip, not override it 2020-10-31 10:00:03 +01:00
sharkdp d69a7d8e04 Update CHANGELOG 2020-10-30 21:58:02 +01:00
sharkdp b1c8606918 Print warning on empty content
closes #107
closes #108
2020-10-30 21:58:02 +01:00
sharkdp d9723592bf Add CONTRIBUTING guide 2020-10-30 20:04:08 +01:00
sharkdp 23fbb5b027 Update CHANGELOG 2020-10-30 20:02:16 +01:00
sharkdp 4d7004f06b Move CHANGELOG entry 2020-10-30 19:57:07 +01:00
purvesh-linux11 c4ed6d9936 add snapstore link to readme 2020-10-30 19:56:44 +01:00
purvesh-linux11 aab0596ea9 add snap information in changelog 2020-10-30 19:56:44 +01:00
purvesh-linux11 7500efffa5 add snap installation steps in redme 2020-10-30 19:56:44 +01:00
sharkdp 80e8026416 Update CHANGELOG 2020-10-30 19:00:36 +01:00
David Peter 13452f5174 Fix .gitattributes
Branch: fix-105
2020-10-30 10:07:24 +01:00
sharkdp 48ff6ff956 Bump min. required Rust version to 1.39 2020-10-30 10:07:24 +01:00
sharkdp 54cab89821 Force LF line ending to fix tests on Windows 2020-10-30 10:07:24 +01:00
sharkdp bb6a3c0650 Add test for --length, fix #105 2020-10-30 10:07:24 +01:00
sharkdp 09c22e09b9 Add simple integration tests 2020-10-30 10:07:24 +01:00
suchenguo cc5b308fc9 two New Installation ways
I added two new installation ways of Termux.
2020-08-17 21:25:26 +02:00
Erich Gubler 153b1cccdf feat: make signs significant for byte offsets 2020-08-15 14:11:10 +02:00
sharkdp 7217a60e6e Switch back to MSVC 2020-08-15 14:05:24 +02:00
Erich Gubler 13aec946a3 improvement: make diagnostics for flags involving byte count parsing actually good
This adds an error type called `ByteCountParseError` with a vanilla
`std::error::Error` implementation. The code could be significantly
compressed with a dependency like `thiserror`.

I opted to implement a separate error type for `parse_byte_count` rather
than using `anyhow`'s small ecosystem of error types there (though they
are used in `<binary>::run`) because it allows pairing diagnostic
results with tests, incl. those already written. This can be helpful in
preventing regressions in error diagnostics.
2020-06-17 18:05:42 +02:00
Erich Gubler e0da7b3f82 style: normalize indentation of doc strings literals for args help 2020-06-17 18:05:42 +02:00
Erich Gubler e29a63358d improvement: elide type of reader 2020-06-17 18:05:42 +02:00
Erich Gubler 2bdf5d768f feat: use anyhow for more structured error messages and better error reporting flexibility
This significantly changes the structure of potential output of
top-level errors.  Before, errors that have a `source` were printed on a
single line, with the `source` omitted. Now, an error with a `source`
will be printed like:

```
Error: <`Display` impl of error>

Caused by:
    <`Display` impl of `source` error>
```

If there are multiple `source` errors in a chain, then it will be of the
form:

```
Error: <`Display` impl of error>

Caused by:
    0: <`Display` impl of first `source` error>
    1: <`Display` impl of `source` of `source` error>
    # etc.
```

Now, in practice this never happened before, since the only error
type that ever could return from `<binary>::run` was `std::io::Error`,
which has no `source`. However, `source`s can start being added if, say,
future work involved using `anyhow::Context::context` or custom errors
that implement `std::Error::source` are added to the codebase. I believe
this is a good choice going forward, but I definitely want to foster
discussion and acceptance for it in the open first!
2020-06-17 18:05:42 +02:00
sharkdp a7892881f3 Wrap help text at 90 characters 2020-06-08 23:19:56 +02:00
sharkdp 921a138962 Update version in README 2020-06-07 15:57:20 +02:00
sharkdp f8f410b8ee Simplify is_printable check, closes #78 v0.8.0 2020-06-07 15:26:07 +02:00
sharkdp 7307077a66 Run lib example on TravisCI 2020-06-07 15:14:14 +02:00
sharkdp 3ca002638c Improve help text 2020-06-07 15:12:35 +02:00
sharkdp ccfceaf58c Minor formatting 2020-06-07 15:12:35 +02:00
sharkdp 751b670d5b Fix clippy suggestions 2020-06-07 15:12:35 +02:00
sharkdp 478cc25ffd Bump version to 0.8.0 2020-06-07 15:12:35 +02:00
sharkdp b1c4b0bf2b Update dependencies 2020-06-07 15:12:35 +02:00
sharkdp 1951c59b0c Add CHANGELOG 2020-06-07 15:12:35 +02:00
Erich Gubler ddc3a5c04a BREAKING CHANGE: improvement: change byte counts to be a positive i64 (with newtype PositiveI64) instead of a u64 to take advantage of new skip impl for --seek with non-Seek Inputs like STDIN
This is technically a breaking change because it halves the upper range
of accepted values for byte counts. I thought that fine under the
assumption it will be rare for users to ever want to specify something
in the upper half of `u64`'s value range, especially considering that
this can pave the way for having negative byte offsets (instead of just
counts).
2020-06-07 11:08:01 +02:00
Erich Gubler 6d5c61b671 BREAKING CHANGE: improvement(lib): use u64 for Printer::display_offset and Squeezer::process, not usize
Technically a breaking change for architectures where
`size_of::<usize>() > size_of::<u64>()`, but that strikes me as
extremely unlikely.

This change is important because most file seek offsets, even on older
architectures with word sizes smaller than `u32`, accept a `u64`. In
particular, Rust's own `std` acknowledges this. So, we're actually going
against prior art in Rust by using a `usize`.
2020-06-07 11:08:01 +02:00
Erich Gubler c5c8d1190f BREAKING CHANGE: feat(lib): skip forward when relative forward seeks are specified on non-seekable streams
This is technically a breaking change, since the data and behavior of
`Input` is exposed publicly. However, it seems unlikely to me that
clients actually depended on a failure in the case that's being changed.
2020-06-07 11:08:01 +02:00
Erich Gubler 1459616d27 improvement: use or instead of unwrap_or_else for display_offset 2020-06-07 11:08:01 +02:00
Erich Gubler 8af8a94699 improvement(lib): align string literals better for black-box tests 2020-05-28 18:44:23 +02:00
Erich Gubler 07cdc97e74 improvement: replace trim_start_matches with slicing op 2020-05-28 18:43:53 +02:00
Erich Gubler bcca1fae03 feat: add block unit and block-size option 2020-05-28 18:43:53 +02:00
Erich Gubler 48ad95efe6 feat: add units system to decimals with {k,m,g,t}[[i]b] support 2020-05-28 18:43:53 +02:00
Erich Gubler 3b3889967c refactor: extract "0x" literal into HEX_PREFIX 2020-05-28 18:43:53 +02:00
Erich Gubler 57f1fb4dc4 BREAKING CHANGE: improvement: disallow leading '+' after "0x" prefix for u64 parse 2020-05-28 18:43:53 +02:00
Erich Gubler ef40be0d53 improvement: fix or_fun_call lint from clippy 2020-05-28 18:43:53 +02:00