A command-line dictionary application written in Rust for managing word translations with an interactive interface.
- Interactive CLI: Command history and line editing with rustyline
- Persistent Storage: JSON-based storage in
~/.config/dictionary/ - Multi-language Support: Store multiple translations per word
- Command History: Navigate previous commands with arrow keys
- Color-coded Output: Easy-to-read terminal interface
- Phrase Support: Handle multi-word phrases with quotes
# Clone the repository
git clone https://github.com/andckadir/cli-dictionary.git
cd dictionary
# Install using cargo
cargo install --path .cargo build --release
# Binary will be in target/release/dictionaryStart the application:
dictadd -w <word> -t <translation(s)>Examples:
add -w hello -t merhaba
add -w danger -t tehlike,risk
add -w "rely on" -t "güvenmek,bel bağlamak"del -w <word> -t <translation(s)>Example:
del -w danger -t riskrmv -w <word>Example:
rmv -w hellocat -w <word> # Show translations for a specific word
cat -w * # List all words in dictionaryclr # Clear screen
hlp # Show help menu
exit/quit/q # Exit the application- ↑/↓: Navigate command history
- Ctrl+C: Cancel current input
- Ctrl+D: Exit application
- Ctrl+A: Move to beginning of line
- Ctrl+E: Move to end of line
- Dictionary data:
~/.config/dictionary/dictionary.json - Command history:
~/.config/dictionary/dictionary_history.txt
# Start the application
$ dict
# Add a word with single translation
add -w book -t kitap
# Add a word with multiple translations
add -w fast -t hızlı,çabuk,süratli
# Add a phrase
add -w "give up" -t "vazgeçmek,pes etmek"
# View a word's translations
cat -w book
# View all words
cat -w *
# Delete a specific translation
del -w fast -t çabuk
# Remove a word completely
rmv -w book
# Exit
exit- rustyline - Readline implementation for command history
- serde - Serialization framework
- serde_json - JSON support
- dirs - System directory paths
- Rust 1.70 or higher
- Cargo
git clone https://github.com/andckadir/cli-dictionary.git
cd dictionary
cargo build --releasecargo testThe dictionary is stored as JSON:
[
{
"word": "hello",
"translations": ["merhaba", "selam"]
},
{
"word": "book",
"translations": ["kitap"]
}
]cargo uninstall dictionaryTo remove all data:
rm -rf ~/.config/dictionaryContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Rust 🦀
- Inspired by the need for a simple, offline dictionary tool
Note: This is a personal dictionary tool. For production use with sensitive data, consider adding encryption for stored translations.