Skip to content

Commit 6d00b04

Browse files
docs: update README
1 parent f090bf3 commit 6d00b04

File tree

6 files changed

+51
-44
lines changed

6 files changed

+51
-44
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "practicestuff"
3-
version = "0.2.6"
3+
version = "0.3.0"
44
description = "Simple CLI trainer for improving calculation and memorisation skills"
55
authors = ["Bartłomiej Jaszczak"]
66
repository = "https://gitlab.com/bartekjaszczak/practicestuff"

README.md

+39-32
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,49 @@
11
# WIP
22

3-
This is a work in progress and not all functionalities may function correctly (or even be implemented).
3+
This is a work in progress. Basic functionality has already been implemented, but there are a few things I'm planning to do:
4+
5+
- coloured output with --colour option to control it
6+
- time rush mode (as many correct answers in given time)
7+
- various feedback options (to replace boring "Correct" and "Incorrect" messages)
8+
- GitLab & GitHub CI integration
49

510
# practicestuff
611

712
**practicestuff** is a CLI app designed to help you practise skills by asking questions and checking your answers. At the end, you'll see a number of correct answers, as well as some statistics. You can stop early by pressing `Ctrl+C`.
813

914
The application should work on all platforms.
1015

11-
List of skills:
16+
Current list of skills:
1217

1318
- powers of a number
1419
- multiplication table (times table)
15-
- doomsday algorithm (not yet implemented)
20+
- doomsday algorithm
21+
22+
## Installation
23+
24+
To install the application, you need cargo. Then, run:
25+
26+
```bash
27+
cargo install practicestuff
28+
```
29+
30+
## Usage
31+
32+
If you're fine with the defaults, choose a skill to practise (e.g., powers) and simply run:
33+
34+
```bash
35+
practicestuff powers
36+
```
37+
38+
You'll be presented with 20 questions and at the end you'll see how it went. If you don't like the defaults, you can adjust some settings. To display configuration options use help:
39+
40+
```bash
41+
# General configuration options and available commands/skills
42+
practicestuff --help
43+
44+
# Powers specific options
45+
practicestuff powers --help
46+
```
1647

1748
## Configuration options
1849

@@ -35,40 +66,16 @@ Allows to practise powers. Configurable parameters include:
3566

3667
Allows to practise multiplications. Factors' range is configurable (default: 1-10 (regular times table)).
3768

38-
# Development
39-
40-
## Initial assumptions
41-
42-
- User has to choose a mode (skill) and optionally some flags/settings
43-
- User is presented with a number of questions for certain skill and has to type a correct answer
44-
- User should be able to quit at any time
45-
- Some statistics should be presented (accuracy, response time, overall time)
46-
- There should be a help flag available
47-
- Argument parsing should be done without `clap` or any other library
48-
- There should be some options to be set:
49-
- Option to set number of questions (including endless mode)
50-
- Option to show current accuracy between questions (default: true). Overall accuracy is presented at the end nevertheless
51-
- Option to exit early
52-
- Option to change behaviour on incorrect answer: continue to next question, show correct answer and continue, repeat
53-
- It should be relatively easy to add new skills
54-
- All skills should be configurable
55-
56-
## Current TODO
69+
### Doomsday algorithm
5770

58-
### Doomsday
71+
Allows to practise calculating the day of the week for a given date. Year range is configurable. By default, the application presents questions with dates ranging from ~1900 to ~2100, with a slight chance to go beyond. When either lower or upper limit is set, the date is picked randomly with equal probability for each year.
5972

60-
- help & usage prompts
61-
- question generation w/ options
62-
- tests
73+
# Rationale
6374

64-
### Improvements
75+
I created this simple app because I wanted to learn and practice the Doomsday algorithm. Later I thought that it might be cool not to limit the app to just one skill, but allow extensible architecture. I also didn't want to use any external libraries for argument parsing, so I implemented that myself as well.
6576

66-
- coloured output (termcolor?) with --no-color option
67-
- additional mode (as many answers in given time)
68-
- multiple texts for "correct" and "incorrect" answers
69-
- gitlab & github CI
7077

71-
## What's next & bug reports
78+
# What's next & bug reports
7279

7380
The application in its current state suits my needs, but I'm open for proposals, either for new skills to practise or more configurability. If you feel that the app lacks something, feel free to open an issue or a PR! I'd be more than happy.
7481

src/application.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::sync::Arc;
66
use crate::args::prelude::*;
77
use crate::config::{BehaviourOnError, Config, NumberOfQuestions};
88
use crate::question::{Question, Generator};
9-
// use crate::skill::doomsday_algorithm;
9+
use crate::skill::doomsday_algorithm;
1010
use crate::skill::powers;
1111
use crate::skill::times_table;
1212
use crate::skill::Skill;
@@ -15,10 +15,10 @@ use crate::stats;
1515
pub const APP_NAME: &str = env!("CARGO_PKG_NAME");
1616
const VERSION: &str = env!("CARGO_PKG_VERSION");
1717

18-
const COMMANDS: [help::Command; 2] = [
18+
const COMMANDS: [help::Command; 3] = [
1919
help::Command::new(powers::CMD, "Practise powers (configurable base)."),
2020
help::Command::new(times_table::CMD, "Practise multiplication table."),
21-
// help::Command::new(doomsday_algorithm::CMD, "Practise the Doomsday algorithm."),
21+
help::Command::new(doomsday_algorithm::CMD, "Practise the Doomsday algorithm."),
2222
];
2323

2424
pub struct Application;

src/config.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,15 @@ impl GeneralOptions {
226226
Arg::builder()
227227
.id(ARG_ID_BEHAVIOUR_ON_ERROR)
228228
.short_name('b')
229-
.long_name("behaviour-on-error")
229+
.long_name("behavior-on-error")
230230
.description(vec![
231231
"Define behaviour on incorrect answer:".to_string(),
232232
"(default: showcorrect):".to_string(),
233233
" - continue: proceed to the next question.".to_string(),
234-
" - showcorrect: proceed to the next" .to_string(),
235-
" question and display the correct answer." .to_string(),
236-
" - repeat: ask the question again until" .to_string(),
237-
" the correct answer is provided." .to_string(),
234+
" - showcorrect: proceed to the next".to_string(),
235+
" question and display the correct answer.".to_string(),
236+
" - repeat: ask the question again until".to_string(),
237+
" the correct answer is provided.".to_string(),
238238
])
239239
.kind(ArgKind::Value(ValueKind::OneOfStr(vec![
240240
BEHAVIOUR_ON_ERROR_CONTINUE.to_string(),
@@ -325,7 +325,7 @@ mod tests {
325325
"command".to_string(),
326326
"--number-of-questions=10".to_string(),
327327
"--disable-live-statistics".to_string(),
328-
"--behaviour-on-error=repeat".to_string(),
328+
"--behavior-on-error=repeat".to_string(),
329329
"powers".to_string(),
330330
];
331331
let config = Config::build(&args).expect("should build successfully");

src/skill/doomsday_algorithm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl Doomsday {
155155
fn check_boundaries(
156156
lower_boundary: i32,
157157
upper_boundary: i32,
158-
arg_definitions: &Vec<Arg>,
158+
arg_definitions: &[Arg]
159159
) -> Result<bool, String> {
160160
if lower_boundary > upper_boundary {
161161
return Err(Self::build_err_message(Some(

0 commit comments

Comments
 (0)