Skip to content

Commit

Permalink
docs: document cli flags
Browse files Browse the repository at this point in the history
  • Loading branch information
max-niederman committed Jul 25, 2022
1 parent 550be1e commit 3104f80
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
26 changes: 25 additions & 1 deletion README.md
Expand Up @@ -24,7 +24,30 @@ cargo install ttyper

## usage

For usage instructions, you can run `ttyper --help`.
For usage instructions, you can run `ttyper --help`:

```
ttyper 1.0.0-pre.1
Terminal-based typing test.
USAGE:
ttyper [FLAGS] [OPTIONS] [contents]
FLAGS:
-d, --debug
-h, --help Prints help information
--list-languages List installed languages
-V, --version Prints version information
OPTIONS:
-c, --config <config> Use config file
-l, --language <language> Specify test language
--language-file <language-file> Specify test language in file
-w, --words <words> Specify word count [default: 50]
ARGS:
<contents>
```

### examples

Expand All @@ -33,6 +56,7 @@ For usage instructions, you can run `ttyper --help`.
| `ttyper` | 50 of the 200 most common english words |
| `ttyper -w 100` | 100 of the 200 most common English words |
| `ttyper -w 100 -l english1000` | 100 of the 1000 most common English words |
| `ttyper --language-file lang` | 50 random words from the file `lang` |
| `ttyper text.txt` | contents of `text.txt` split at newlines |

## languages
Expand Down
1 change: 1 addition & 0 deletions src/config.rs
Expand Up @@ -226,6 +226,7 @@ where
deserializer.deserialize_str(ColorVisitor)
}

#[cfg(test)]
mod tests {
use super::*;

Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Expand Up @@ -36,15 +36,19 @@ struct Opt {
#[structopt(short, long)]
debug: bool,

/// Specify word count
#[structopt(short, long, default_value = "50")]
words: num::NonZeroUsize,

/// Use config file
#[structopt(short, long)]
config: Option<PathBuf>,

/// Specify test language in file
#[structopt(long, parse(from_os_str))]
language_file: Option<PathBuf>,

/// Specify test language
#[structopt(short, long)]
language: Option<String>,

Expand Down
6 changes: 1 addition & 5 deletions src/ui.rs
Expand Up @@ -9,7 +9,6 @@ use std::iter;
use tui::{
buffer::Buffer,
layout::{Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style},
symbols::Marker,
text::{Span, Spans, Text},
widgets::{Axis, Block, BorderType, Borders, Chart, Dataset, GraphType, Paragraph, Widget},
Expand Down Expand Up @@ -296,10 +295,7 @@ impl ThemedWidget for &results::Results {
.data(&wpm_sma)];

let wpm_chart = Chart::new(wpm_datasets)
.block(
Block::default()
.title(vec![Span::styled("Chart", theme.title)])
)
.block(Block::default().title(vec![Span::styled("Chart", theme.title)]))
.x_axis(
Axis::default()
.title(Span::styled("Keypresses", theme.results_chart_x))
Expand Down

0 comments on commit 3104f80

Please sign in to comment.