Skip to content

Commit

Permalink
Merge pull request #109 from ReagentX/feat/cs/readme-headings
Browse files Browse the repository at this point in the history
Update readme headings
  • Loading branch information
ReagentX authored Feb 12, 2023
2 parents d33ade7 + 41a4dd1 commit 6831023
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 28 deletions.
78 changes: 67 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ regex = "1.6.0"
serde = {version = "1.0.139", features = ["derive"]}
serde_json = "1.0.82"
time = {version = "0.3.11", features = ["formatting", "parsing"]}
tokio = {version = "1.20.1", features = [
tokio = {version = "1.25.0", features = [
"process",
"io-util",
"rt-multi-thread",
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ A powerful CLI tool that puts log aggregation at your fingertips.

There are several options to install this app.

### Normal Usage
### Cargo (recommended)

This binary is available on [crates.io](https://crates.io/crates/logria)
This binary is available on [crates.io](https://crates.io/crates/logria).

`cargo install logria` is the best way to install the app for normal use.

Expand All @@ -27,14 +27,14 @@ See [Advanced Installation](docs/README.md#advanced-installation).

## Usage

There are a few main ways to invoke Logria:
There are a few ways to invoke Logria:

- Directly:
- `logria`
- Opens to the setup screen
- With args:
- `logria -e 'tail -f log.txt'`
- Opens a pipe to `tail -f log.txt` and skips setup
- Opens a process for `tail -f log.txt` and skips setup
- `logria -h` will show the help page with all possible options

For more details, see [Sample Usage Session](docs/README.md#sample-usage-session).
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ Typing `:` and entering `:q` will exit the app.
## Notes / Caveats

- When using `tmux` or other emulators that change the `$TERM` environment variable, you must set the default terminal to something that supports color. In `tmux`, this is as simple as adding `set -g default-terminal "screen-256color"` to `.tmux.conf`.
- The package version in `Cargo.toml` is `0.0.0`. This is because during CICD that value gets [replaced](/.github/workflows/release.yml) with the current release tag name.
- The package version in `Cargo.toml` is `0.0.0`. This is because during release that value gets [replaced](/.github/workflows/release.yml) with the current release tag name.
16 changes: 6 additions & 10 deletions docs/input_handler.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Input Handler Documentation

Input handlers run in processes parallel to the main process using Python's `multiprocessing` library. Each `InputStream` child class implements a method that creates two pipes, one for `stdin` and one for `stdout`. The data sent through these pipes are stored in a Queue, which the main process can read from to render.
Input handlers run in processes parallel to the main process and communicate using Rust's `mpsc` module. Each struct that implements the `Input` trait has a method that creates two sets of `mpsc` channels, one for `stdin` and one for `stdout`. The data sent through these channels are stored until the main process can read from them.

## `CommandInputStream` Objects
## `CommandInput`

Given a list command parts, use the `subprocess` library to open a shell, run that process, and pipe the responses back into their respective queues.
Given a command, use `tokio`'s `command` module to open process and read its `stderr` and `stdout` into their respective `mpsc` channels.

Commands will be parsed against your PATH variables, replacing programs you have on your path with their fully qualified path.
## `FileInput`

Creating a `CommandInputStream()` with `args` like `['tail', '-f', 'out.log']` will open a shell that runs `/usr/bin/tail -f out.log`.
Given a file path, read the file and send the output to the `stdout` queue.

## `FileInputStream` Objects

Given a list that represents a file path, read in the file and send the output to the `stdout` queue.

Creating a `FileInputStream()` with `args` like `["sample_streams", "accesslog"]` will read in the contents of `sample_streams/accesslog` to the `stdout` queue.
Creating a `FileInput()` with `"sample_streams/accesslog"` will read in the contents of `sample_streams/accesslog` to the `stdout` queue. The path is parsed relative to the current directory when starting `logria`.
4 changes: 3 additions & 1 deletion src/communication/handlers/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ impl Handler for StartupHandler {
Ok(command) => command,
Err(why) => panic!("Unable to gather text: {:?}", why),
};
self.process_command(window, &command)?;
if !command.is_empty() {
self.process_command(window, &command)?;
}
}

// User input
Expand Down

0 comments on commit 6831023

Please sign in to comment.