Skip to content

Commit 3f5ed58

Browse files
committed
- doc update & support for upper case file extensions
1 parent b726f66 commit 3f5ed58

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[package]
22
name = "json-lines-viewer"
3-
version = "0.4.3"
3+
version = "0.4.4"
44
edition = "2024"
5-
description = "JSON Lines Viewer - Terminal-UI to view application logs in 'Json line format' or Zip files containing such files"
5+
description = "JSON Lines Viewer - Terminal-UI to view JSON line files (e.g. application logs) or Zip files containing such files"
6+
documentation = "https://github.com/bitmagier/json-lines-viewer"
67
authors = ["Roman Krüger"]
7-
keywords = ["Json", "viewer", "TUI"]
8+
keywords = ["JSON", "viewer", "TUI"]
89
license = "MIT"
910
repository = "https://github.com/bitmagier/json-lines-viewer"
1011

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
JSON Lines Viewer
22
---
3-
A terminal-UI to browse through JSON-line files.
3+
Terminal-UI to view JSON line files (e.g. application logs) or Zip files containing such files
44

55
_The main use case is to support the analysis of comprehensive application logs in 'Json line' format._
66

@@ -17,11 +17,11 @@ Download precompiled binary for your platform from Github.
1717
## Usage
1818

1919
```
20-
JSON Lines Viewer - Terminal-UI to view application logs in 'Json line format' or Zip files containing such files.
20+
JSON Lines Viewer - Terminal-UI to view '.json' line files (e.g. application logs) or Zip files containing such files
2121
2222
Navigation: Cursor keys, PageUp/Down, Enter/Esc.
23-
Find content: Ctrl-f or '/' and navigate to next/previous finding via cursor Down/Up.
24-
Save current settings: Ctrl-s (e.g. field order. Settings come from commandline arguments and a previously saved config file)
23+
Search content: Ctrl-f or '/' and navigate to next/previous finding via cursor down/up. Leave search field with `Esc`.
24+
Save current settings: Ctrl-s (Settings may come from commandline options and a previously saved config file)
2525
2626
Usage: json-lines-viewer [OPTIONS] [FILES]...
2727
@@ -38,14 +38,16 @@ Options:
3838
3939
-h, --help
4040
Print help (see a summary with '-h')
41+
42+
-V, --version
43+
Print version
4144
```
4245

4346
### Example
4447
```
45-
json-lines-viewer --field-order @timestamp,level,application_id,message,application_version,land,host_ipv4,host_name,thread_name,correlation_id,logger_name logs-export-XXXX.zip
48+
json-lines-viewer --field-order @timestamp,level,application_id,message,application_version,land,host_ipv4,host_name,thread_name,correlation_id,logger_name logs-export-xxxxx.zip
4649
```
4750

48-
4951
## Program navigation / usage
5052

5153
- Use Cursor Keys and PageUp/PageDown to navigate on a page

src/main.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ use std::io::BufRead;
1818
use std::path::{Path, PathBuf};
1919

2020
#[derive(Parser, Debug)]
21-
#[command(version, about, long_about = Some("JSON Lines Viewer - Terminal-UI to view application logs in 'Json line format' or Zip files containing such files.\n\
22-
\n\
23-
Navigation: Cursor keys, PageUp/Down, Enter/Esc.\n\
24-
Search content: Ctrl-f or '/' and navigate to next/previous finding via cursor Down/Up.\n\
25-
Save current settings: Ctrl-s (e.g. field order. Settings come from commandline arguments and a previously saved config file)"))]
21+
#[command(version, about, long_about = Some("JSON Lines Viewer - Terminal-UI to view JSON line files (e.g. application logs) or Zip files containing such files\n\
22+
\n\
23+
Navigation: Cursor keys, PageUp/Down, Enter/Esc.\n\
24+
Search content: Ctrl-f or '/' and navigate to next/previous finding via cursor down/up. Leave search field with `Esc`.\n\
25+
Save current settings: Ctrl-s (Settings may come from commandline options and a previously saved config file)"))]
2626
struct Args {
2727
/// JSON line input files - `.json` or `.zip` files(s) containing `.json` files
2828
files: Vec<PathBuf>,
@@ -98,7 +98,11 @@ fn load_files(files: &[PathBuf]) -> anyhow::Result<RawJsonLines> {
9898
let mut raw_lines = RawJsonLines::default();
9999

100100
for path in files {
101-
match path.extension().and_then(|e| e.to_str()) {
101+
match path.extension()
102+
.and_then(|e| e.to_str())
103+
.map(|e| e.to_ascii_lowercase())
104+
.as_deref()
105+
{
102106
Some("json") => load_lines_from_json(&mut raw_lines, path).with_context(|| format!("failed to load lines from {path:?}"))?,
103107
Some("zip") => load_lines_from_zip(&mut raw_lines, path).with_context(|| format!("failed to load lines from {path:?}"))?,
104108
_ => eprintln!("unknown file extension: '{}'", path.to_string_lossy()),
@@ -142,7 +146,7 @@ fn load_lines_from_zip(
142146
.by_index(i)
143147
.with_context(|| format!("failed to get file with index {i} from zip"))?;
144148

145-
if !f.is_file() || !f.name().ends_with(".json") {
149+
if !f.is_file() || !f.name().to_ascii_lowercase().ends_with(".json") {
146150
continue;
147151
}
148152

0 commit comments

Comments
 (0)