mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
skip option error messages and display offset
This commit is contained in:
1 parent
133fdd9156
commit
c336259159
2 files changed
+17
-6
No files matched your search
+4
-4
@@ -93,10 +93,10 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||
None => Input::Stdin(stdin.lock()),
|
||||
};
|
||||
|
||||
let skip_arg = matches.value_of("skip");
|
||||
let skip_arg = matches.value_of("skip").and_then(parse_hex_or_int);
|
||||
|
||||
if let Some(length) = skip_arg.and_then(parse_hex_or_int) {
|
||||
reader.seek(SeekFrom::Start(length))?;
|
||||
if let Some(skip) = skip_arg {
|
||||
reader.seek(SeekFrom::Start(skip))?;
|
||||
}
|
||||
|
||||
let length_arg = matches.value_of("length").or(matches.value_of("bytes"));
|
||||
@@ -124,7 +124,7 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let display_offset = matches
|
||||
.value_of("display_offset")
|
||||
.and_then(parse_hex_or_int)
|
||||
.unwrap_or(0);
|
||||
.unwrap_or(skip_arg.unwrap_or(0));
|
||||
|
||||
let stdout = io::stdout();
|
||||
let mut stdout_lock = stdout.lock();
|
||||
|
||||
Reference in new issue
Block a user