Skip to content

About

A cli dictionary that you can add your words

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dictionary CLI 📚

A command-line dictionary application written in Rust for managing word translations with an interactive interface.

Rust License

Features ✨

  • 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

Installation 🚀

Install from source

# Clone the repository
git clone https://github.com/andckadir/cli-dictionary.git
cd dictionary

# Install using cargo
cargo install --path .

Build manually

cargo build --release
# Binary will be in target/release/dictionary

Usage 💡

Start the application:

dict

Commands

Add a word/translation

add -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"

Delete specific translations

del -w <word> -t <translation(s)>

Example:

del -w danger -t risk

Remove a word entirely

rmv -w <word>

Example:

rmv -w hello

Display translations

cat -w <word>    # Show translations for a specific word
cat -w *         # List all words in dictionary

Other commands

clr          # Clear screen
hlp          # Show help menu
exit/quit/q  # Exit the application

Keyboard Shortcuts

  • ↑/↓: 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

File Locations 📁

  • Dictionary data: ~/.config/dictionary/dictionary.json
  • Command history: ~/.config/dictionary/dictionary_history.txt

Examples 🎯

# 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

Dependencies 📦

  • rustyline - Readline implementation for command history
  • serde - Serialization framework
  • serde_json - JSON support
  • dirs - System directory paths

Building from Source 🔨

Requirements

  • Rust 1.70 or higher
  • Cargo

Build

git clone https://github.com/andckadir/cli-dictionary.git
cd dictionary
cargo build --release

Run tests (if available)

cargo test

Data Format 📄

The dictionary is stored as JSON:

[
  {
    "word": "hello",
    "translations": ["merhaba", "selam"]
  },
  {
    "word": "book",
    "translations": ["kitap"]
  }
]

Uninstall 🗑️

cargo uninstall dictionary

To remove all data:

rm -rf ~/.config/dictionary

Contributing 🤝

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License 📝

This project is licensed under the MIT License - see the LICENSE file for details.

Author ✍️

https://github.com/andckadir

Acknowledgments 🙏

  • 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.

About

A cli dictionary that you can add your words

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages