Skip to content

更新到0.0.13后反复出现查询not found #58

Open
@exaithrg

Description

@exaithrg

首先是环境信息

➜  kd uname -a
Linux ghr7000 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
➜  kd cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.5 LTS"
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
➜  kd    

kd配置是默认的

别名信息

然后是几个下面的错误输出中出现过的alias的内容

➜  kd whcih f
f: aliased to kd_func_everyday
➜  kd whcih kd_func_everyday
kd_func_everyday () {
        local txt
        kd --nocache "$@"
        mkdir -p -p "$ExaithrgVocabBookDir"
        txt=$(NO_COLOR=1 kd "$@")
        echo "========================================================================" >> "$ExaithrgVocabBookDir/everyday_language.txt"
        echo ">>> $@" >> "$ExaithrgVocabBookDir/everyday_language.txt"
        echo "------------------------------------------------------------------------" >> "$ExaithrgVocabBookDir/everyday_language.txt"
        echo "$txt" >> "$ExaithrgVocabBookDir/everyday_language.txt"
        echo "" >> "$ExaithrgVocabBookDir/everyday_language.txt"
}
➜  kd which a
a: aliased to kd_func_academic
➜  kd whcih kd_func_academic
kd_func_academic () {
        local txt
        kd --nocache "$@"
        mkdir -p -p "$ExaithrgVocabBookDir"
        txt=$(NO_COLOR=1 kd "$@")
        echo "========================================================================" >> "$ExaithrgVocabBookDir/academic_language.txt"
        echo ">>> $@" >> "$ExaithrgVocabBookDir/academic_language.txt"
        echo "------------------------------------------------------------------------" >> "$ExaithrgVocabBookDir/academic_language.txt"
        echo "$txt" >> "$ExaithrgVocabBookDir/academic_language.txt"
        echo "" >> "$ExaithrgVocabBookDir/academic_language.txt"
}
➜  kd which ff
ff: aliased to kdl_func_everyday
➜  kd whcih kdl_func_everyday
kdl_func_everyday () {
        local txt
        kd -t --nocache "$@"
        mkdir -p -p "$ExaithrgVocabBookDir"
        txt=$(NO_COLOR=1 kd -t "$@")
        echo "========================================================================" >> "$ExaithrgVocabBookDir/everyday_language.txt"
        echo ">>> $@" >> "$ExaithrgVocabBookDir/everyday_language.txt"
        echo "------------------------------------------------------------------------" >> "$ExaithrgVocabBookDir/everyday_language.txt"
        echo "$txt" >> "$ExaithrgVocabBookDir/everyday_language.txt"
        echo "" >> "$ExaithrgVocabBookDir/everyday_language.txt"
}
➜  kd   

错误输出

典型的错误输出如下:

~ ff double underscores
Not found :(
➜  ~ ff hello world
Not found :(
➜  ~ kd -t hello world
hello world
你好,世界:一个用于展示编程语言基本语法和结构的示例程序。
➜  ~ ff hello world
≫  未找到守护进程,正在启动...
✔  成功启动守护进程,PID:10768
hello world
你好,世界:一个用于展示编程语言基本语法和结构的示例程序。
➜  ~ ff double underscores
≫  未找到守护进程,正在启动...
✔  成功启动守护进程,PID:10829
double underscores
双下划线

可以发现, ff double underscores输出了not found,这是不应该的,结果等了一会之后 ff double underscores又能正常翻译了。
以及

~ f prologoe
≫  未找到守护进程,正在启动...
✔  成功启动守护进程,PID:594
Not found :(
➜  ~ f prologue
Not found :(
➜  ~ f lethal
Not found :(
➜  ~ whcih f
f: aliased to kd_func_everyday
➜  ~ f hello
Not found :(
➜  ~ kd hello
Not found :(
➜  ~ kd world
world    [美 wɝld / 英 wɜːld]
n. 世界;领域;宇宙;世俗;全人类;物质生活
...

显然,kd hello不应该显示Not found :(
该问题在升级到0.0.13之后反复出现,下面是更多类似的例子:

~ a garbled
Not found :(
➜  ~ a garbled
Not found :(
➜  ~ a hello
Not found :(
➜  ~ kd hello
hello    [美 həˈloʊ / 英 həˈləʊ]
int. 喂,你好(用于问候或打招呼);喂,你好(打电话时的招呼语) ;喂,你好(引起别人注意的招呼语);<非正式>喂,嘿 (认为别人说了蠢话或分心);<英,旧>嘿(表示惊讶)
n. 招呼,问候;(Hello)(法、印、美、俄)埃洛(人名)
v. 说(或大声说)“喂”;打招呼
★★★ CET4 TEM4 alsohullo
⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺
1. (CONVENTION) You say "Hello" to someone when you meet them.  你好 (打招呼用语) [套语]
   ≫   Hello, Trish. I won't shake hands, because I'm filthy.   你好,特里斯。我就不握手了,我的手好脏。
2. (N-COUNT) Hello is also a noun. 招呼
   ≫   The salesperson greeted me with a warm hello.  那位推销员向我打了个热情的招呼。
3. (CONVENTION) You say "Hello" to someone at the beginning of a telephone conversation, either when you answer the phone or before you give your name or say why you are phoning. 喂 (打电话时 的招呼语) [套语]
   ≫   A moment later, Cohen picked up the phone. "Hello?"  一会儿之后,科恩拿起电话。“喂?”
4. (CONVENTION) You can call "hello" to attract someone's attention. 喂 (用于唤起别人注意)
   ≫   Very softly, she called out: "Hello? Who's there?"  她很 轻柔地喊道:“喂?谁在那儿?”
➜  ~ kd garbled
garbled    [美 'ɡɑrbld]
adj. 篡改的;混乱的;引起误解的
v. 断章取义(garble的过去式和过去分词)
⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺
1. (ADJ) A garbled message or report contains confused or wrong details, often because it is spoken by someone who is nervous or in a hurry. (信息或报告) 混乱不清的
   ≫   The Coast Guard needs to decipher garbled messages in a few minutes.  海岸警卫队需要在几分钟内破译含混不清的讯息。
➜  ~ a garbled
garbled    [美 ˈɡɑːrb(ə)ld / 英 ˈɡɑːb(ə)ld]
adj. 篡改的;混乱的;引起误解的
v. 断章取义(garble 的过去式和过去分词)
⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺
1. (ADJ) A garbled message or report contains confused or wrong details, often because it is spoken by someone who is nervous or in a hurry. (信息或报告) 混乱不清的
   ≫   The Coast Guard needs to decipher garbled messages in a few minutes.  海岸警卫队需要在几分钟内破译含混不清的讯息。
➜  ~    

解决方案与建议

目前我已经回退到了0.0.12版本

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions