Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
Update package config
Browse files Browse the repository at this point in the history
  • Loading branch information
apua committed Oct 15, 2021
1 parent c8d4476 commit 81f34c5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ description = "Look up words via online dictionaries"
# Will automatically link to the corresponding docs.rs page if not given.
# Must set it because docs.rs only render libraries.
# ref: https://doc.rust-lang.org/cargo/reference/manifest.html#the-documentation-field
#documentation = ""
#homepage = ""
#repository = ""
documentation = "https://github.com/zdict/rust-zdict"
homepage = "https://github.com/zdict/rust-zdict"
repository = "https://github.com/zdict/rust-zdict"


[dependencies]
Expand Down
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# zdict

A Rust version of [zdict](https://github.com/zdict/zdict).


## Install

```console
cargo install --git https://github.com/zdict/rust-zdict
```


## Usage

```
zdict
USAGE:
zd [FLAGS] [OPTIONS] <word>...
zd <SUBCOMMAND>
ARGS:
<word>... Search translation of words
FLAGS:
-d, --disable-db-cache Temporarily not using the result from db cache. (still save the result
into db)
-h, --help Print help information
--show-provider Show dictionary provider
--show-url Show URL
-v, --verbose Use verbose output
-V, --version Print version information
OPTIONS:
--dict <DICT> Choose the dictionary [possible values: yahoo, urban, all]
SUBCOMMANDS:
dicts Show currently supported dictionaries
```

![](https://user-images.githubusercontent.com/829295/137491540-e1db8ba4-0129-4d6e-af82-21b5399cfbb4.png)
15 changes: 9 additions & 6 deletions src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,20 @@ fn lookup<Entry: Lookup>(word: &str, opts: &Opts, db_cache: Option<&Cache>) {
}

fn show_failure<Entry: Lookup>(err: BoxError, word: &str) {
let repo = "https://github.com/zdict/rust-zdict/";
let issues = format!("{}issues", repo);
println!("\
{err:?}\n\
{err}\n\
================================================================================\n\
Entryionary: {} ({})\n\
Word: '{}'\n\
Entryionary: {dict_title} ({dict_name})\n\
Word: '{word}'\n\
================================================================================\n\
\n\
Houston, we got a problem 😢\n\
Please report the error message above to {}\
", Entry::DICT.title, Entry::DICT.name, word, issues, err=err);
Please report the error message above to {issues}",
dict_title = Entry::DICT.title,
dict_name = Entry::DICT.name,
word = word,
issues = format!("{}/issues", env!("CARGO_PKG_REPOSITORY")),
err = err
);
}

0 comments on commit 81f34c5

Please sign in to comment.