aboutsummaryrefslogtreecommitdiff
path: root/crates/cli/src/words.rs
Commit message (Collapse)AuthorAgeFilesLines
* Split lib.rs into multiple filesMiquel Sabaté Solà2026-01-291-38/+33
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* words: allow the creation of irregular wordsMiquel Sabaté Solà2026-01-291-2/+18
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Move declension/conjugation IDs into enumsMiquel Sabaté Solà2026-01-281-96/+177
| | | | | | | | | | | | | | | | | | There were quite a lot of hacks that came out of my laziness on refusing to give inflections their own proper enums. This commit introduces this, while also providing implementations for the traits involving SQL. This way, moving data in and out from these enums feels more seamless. One advantage from this move is that a lot of redundant checks are gone, as the validation checks are performed when fetching the data. This is one of those times in which type masturbation as encouraged by the Rust programming language actually makes sense. Last but not least, this conversion also allows us to perform a change on the creation/edit of words, as suggestions can be done for conjugations/declensions and their kinds. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* words: improve the description on verb conjugationMiquel Sabaté Solà2026-01-271-2/+13
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* words: add the 'rel' subcommandMiquel Sabaté Solà2026-01-271-0/+81
| | | | | | | This is a more general way to establish the relationship between two words. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* words: delete all relationships on 'rm'Miquel Sabaté Solà2026-01-241-1/+10
| | | | | | | | | When removing a word, all relationships with other words and tags should also be cleared. Not that it would litter too much the database (considering the DB is relatively small), but it doesn't take too much effort to play nice here. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* words: make alternative relationships two-waysMiquel Sabaté Solà2026-01-241-1/+11
| | | | | | | | | | The 'alternative' relationship was only being created on a single direction when calling 'words dup', while in this case it should go both ways so the 'words show' command can pick things up easily. Considering how I don't think I'll have too many words to begin with, this sort of duplication shouldn't be too troublesome, and it makes code easier. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* words: add the 'dup' subcommandMiquel Sabaté Solà2026-01-221-2/+116
| | | | | | This is an easy way to create alternatives from existing words. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* words: show relevant flags as wellMiquel Sabaté Solà2026-01-221-6/+57
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* words: improve the wording on editing flagsMiquel Sabaté Solà2026-01-221-0/+3
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Allow to pair tags with words on words create/editMiquel Sabaté Solà2026-01-211-4/+86
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* words: add the --tag flag to the ls commandMiquel Sabaté Solà2026-01-211-15/+42
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* words: add the poke subcommandMiquel Sabaté Solà2026-01-191-0/+27
| | | | | | | | This subcommand allows the user to update the `updated_at` timestamp, which is quite relevant as this timestamp is used when selecting words. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* run: ask for alternatives as wellMiquel Sabaté Solà2026-01-191-6/+6
| | | | | | | | This commit also fixes the need to ask for a random gender when asking for adjectives. This is somewhat unrelated to the main subject, but untying this now was a bit too much of a hassle. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Display related words on the 'words show' commandMiquel Sabaté Solà2026-01-191-1/+86
| | | | | | | This includes comparative/superlative/adverbial forms for adjectives, and alternative forms because of gender or otherwise. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Migrate from usize to isize for integers in modelsMiquel Sabaté Solà2026-01-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | SQLite3, like many other DBs (e.g. PostgreSQL), assumes by default an i64::MAX value. Hence, while in the application we are talking mainly in unsigned terms (which is what makes sense here), this is not realistic to what ends up happening on the DB side. Up until now this just worked behind the scenes because rustqlite did the heavy lifting via default trait implementations of usize which handled this translation for us. This default implementation for usize was dropped in 0.38.0 (see [1]). Even if it can be enabled back via the "fallible_uint" feature, it's more fair to stick to isize, as it's not much of a problem on our side, and it's more transparent in regards to what happens in the end in the DB. Last but not least, this commit also upgrades rustqlite to the latest 0.38.0, with the rest of the dependency tree. [1] https://github.com/rusqlite/rusqlite/issues/1722) Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Fix style issues coming from recent mergeMiquel Sabaté Solà2026-01-131-6/+5
| | | | | | | | | I apparently merged the 'inflection' branch without checking the code style. This means that a lot of warnings are being raised by clippy and I'm unsure which commit did what. Since I'm lazy about this right now, let's bring all fixes in a single commit. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add basic validation for verbs and pronounsMiquel Sabaté Solà2026-01-131-9/+23
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Trim word parts on database insertMiquel Sabaté Solà2025-10-271-1/+3
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Provide initial implementation for word inflectionMiquel Sabaté Solà2025-10-271-19/+165
| | | | | | | | | | Word inflection for nouns, adjectives has been added so it can be initially be used in commands like 'words show'. Word categories which have no inflections (e.g. adverbs, conjunctions, et al) are skipped. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add the exercises commandMiquel Sabaté Solà2025-07-291-2/+2
| | | | | | | Subcommands have been added to it which are similar to the ones on words on purpose. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add weight to wordsMiquel Sabaté Solà2025-07-291-0/+16
| | | | | | | This allows for the user to give more importance to some words than others, as that will be taken into account when running `practice`. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Implement the edit subcommand for wordsMiquel Sabaté Solà2025-07-291-98/+185
| | | | | | | This implied replacing the Guess struct for a full Word, so the same code for word creation could be re-used. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* words: Move away the selection of a wordMiquel Sabaté Solà2025-07-251-16/+37
| | | | | | | | This is in preparation to the implementation of the new 'edit' and 'show' subcommands for 'word', which will also need to operate on exactly one word. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Apply suggestions from clippyMiquel Sabaté Solà2025-07-251-27/+50
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Implement creation of wordsMiquel Sabaté Solà2025-07-251-20/+332
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Initial commitMiquel Sabaté Solà2025-06-031-0/+141
Basic commands have been added, but most of the features for this project are still work in progress. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>