From 59f899e8391b4466c202502f824c56c2bb929065 Mon Sep 17 00:00:00 2001 From: April & May Date: Tue, 8 Jul 2025 17:45:16 +0800 Subject: [PATCH 1/6] Fix extra space appended while completing directory --- bash-pinyin-completion.cpp | 9 ++++++--- scripts/bash_pinyin_completion | 9 ++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bash-pinyin-completion.cpp b/bash-pinyin-completion.cpp index 4e18d70..90707f7 100644 --- a/bash-pinyin-completion.cpp +++ b/bash-pinyin-completion.cpp @@ -121,8 +121,11 @@ int main(int argc, char **argv) { input = home + input; } auto split = split_string(input, '/'); - auto final = split.back(); - if (input.back() != '/') { + string final; + if (input.back() == '/') { + final = ""; + } else { + final = split.back(); split.pop_back(); } auto pinyin = string_pinyin(final); @@ -130,7 +133,7 @@ int main(int argc, char **argv) { // Navigate to the dir we need to complete auto dest = filesystem::path(input.c_str()).parent_path(); if (!dest.empty()) { - if (!filesystem::exists(dest)) { + if (!filesystem::exists(dest) || !filesystem::is_directory(dest)) { return 0; } filesystem::current_path(dest); diff --git a/scripts/bash_pinyin_completion b/scripts/bash_pinyin_completion index 2a0ac88..c496262 100644 --- a/scripts/bash_pinyin_completion +++ b/scripts/bash_pinyin_completion @@ -61,7 +61,14 @@ _pinyin_completion() { # Main part local -a pinyin_matched - readarray -t pinyin_matched < <(bash-pinyin-completion "$cur" "$compgen_opts") + if [[ "${compgen_opts[0]}" == -d ]]; then + readarray -t pinyin_matched < <(bash-pinyin-completion "$cur" "-d") + else + readarray -t pinyin_matched < <(bash-pinyin-completion "$cur" "-f") + if [ ${#pinyin_matched[@]} -ne 0 ]; then + compopt -o filenames 2>/dev/null + fi + fi # merge result local -a old_candidates=("${COMPREPLY[@]}") From ef807c3cca9549cbe8366fcab5b747608b084bbb Mon Sep 17 00:00:00 2001 From: April & May Date: Wed, 9 Jul 2025 10:03:20 +0800 Subject: [PATCH 2/6] Exclude non-Chinese options --- bash-pinyin-completion.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/bash-pinyin-completion.cpp b/bash-pinyin-completion.cpp index 90707f7..e28078b 100644 --- a/bash-pinyin-completion.cpp +++ b/bash-pinyin-completion.cpp @@ -142,6 +142,7 @@ int main(int argc, char **argv) { auto compreply = split_string(run_command("/usr/bin/env bash -c \"compgen " + compgen_opts + "\""), '\n'); for (auto reply : compreply) { auto reply_pinyin = string_pinyin(reply); + if (reply_pinyin == reply) continue; if (reply_pinyin.compare(0, pinyin.size(), pinyin) == 0) { for (auto substr : split) { cout << substr << "/"; From fbfe52ecd1d04ca35ad4f3f351056ca595c2a12e Mon Sep 17 00:00:00 2001 From: April & May Date: Wed, 9 Jul 2025 10:17:04 +0800 Subject: [PATCH 3/6] Remove unused test, bump version to 0.0.2 --- debian/changelog | 6 ++++++ debian/control | 4 ++-- test.sh | 38 -------------------------------------- 3 files changed, 8 insertions(+), 40 deletions(-) delete mode 100644 test.sh diff --git a/debian/changelog b/debian/changelog index b59f139..16ebbc3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +bash-pinyin-completion (0.0.2) unstable; urgency=medium + + * Move logic to C++, fix several issues + + -- April Lu Wed, 09 Jul 2025 10:10:00 +0800 + bash-pinyin-completion (0.0.1) UNRELEASED; urgency=medium * Initial release diff --git a/debian/control b/debian/control index 2e5ef91..a979a2a 100644 --- a/debian/control +++ b/debian/control @@ -1,10 +1,10 @@ Source: bash-pinyin-completion Section: shells Priority: optional -Maintainer: Deepin Packages Builder +Maintainer: April Lu Build-Depends: debhelper-compat (= 13) Standards-Version: 4.7.2.0 -Homepage: https://github.com/apr3vau/bash-pinyin-completion-cpp +Homepage: https://github.com/calsym456/bash-pinyin-completion-cpp Package: bash-pinyin-completion Architecture: any diff --git a/test.sh b/test.sh deleted file mode 100644 index 8920c8b..0000000 --- a/test.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -mkdir -p "测试" -correct=0 -if [[ $(./bash-pinyin-completion ce -f) == "测试" ]]; then - echo "Test 1 PASSED" - ((correct += 1)) -else - echo "Test 1 NOT PASSED" -fi - -if [[ $(./bash-pinyin-completion ./ce -f) == "./测试" ]]; then - echo "Test 2 PASSED" - ((correct += 1)) -else - echo "Test 2 NOT PASSED" -fi - -if [[ $(wc -l <<<"$(./bash-pinyin-completion /usr/lib -f)" | xargs) == 2 ]]; then - echo "Test 3 PASSED" - ((correct += 1)) -else - echo "Test 3 NOT PASSED" -fi - -if [[ $(wc -l <<<"$(./bash-pinyin-completion /usr/lib/ -f)" | xargs) -gt 3 ]]; then - echo "Test 4 PASSED" - ((correct += 1)) -else - echo "Test 4 NOT PASSED" -fi - -rm -r "测试" -if [[ correct -lt 4 ]]; then - exit 1 -fi - -exit 0 From 31cdd532f68c00d2494ad51699e195fb152e24b8 Mon Sep 17 00:00:00 2001 From: lichenggang Date: Thu, 3 Jul 2025 14:40:56 +0800 Subject: [PATCH 4/6] feat: add workflows --- .github/workflows/backup-to-gitlab.yml | 12 +++++++++ .github/workflows/call-auto-tag.yml | 17 ++++++++++++ .github/workflows/call-chatOps.yml | 9 +++++++ debian/deepin/OWNERS | 16 ++++++++++++ debian/deepin/workflows.yml | 36 ++++++++++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 .github/workflows/backup-to-gitlab.yml create mode 100644 .github/workflows/call-auto-tag.yml create mode 100644 .github/workflows/call-chatOps.yml create mode 100644 debian/deepin/OWNERS create mode 100644 debian/deepin/workflows.yml diff --git a/.github/workflows/backup-to-gitlab.yml b/.github/workflows/backup-to-gitlab.yml new file mode 100644 index 0000000..8dfd7b3 --- /dev/null +++ b/.github/workflows/backup-to-gitlab.yml @@ -0,0 +1,12 @@ +name: backup to gitlab +on: [push] + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + backup-to-gitlabwh: + uses: deepin-community/.github/.github/workflows/backup-to-gitlabwh.yml@master + secrets: + BRIDGETOKEN: ${{ secrets.BRIDGETOKEN }} diff --git a/.github/workflows/call-auto-tag.yml b/.github/workflows/call-auto-tag.yml new file mode 100644 index 0000000..3f9b471 --- /dev/null +++ b/.github/workflows/call-auto-tag.yml @@ -0,0 +1,17 @@ +name: auto tag + +on: + pull_request_target: + types: [opened, synchronize, closed] + paths: + - "debian/changelog" + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + auto_tag: + uses: deepin-community/.github/.github/workflows/auto-tag.yml@master + secrets: + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/.github/workflows/call-chatOps.yml b/.github/workflows/call-chatOps.yml new file mode 100644 index 0000000..83ef38c --- /dev/null +++ b/.github/workflows/call-chatOps.yml @@ -0,0 +1,9 @@ +name: chatOps +on: + issue_comment: + types: [created] + +jobs: + chatopt: + uses: deepin-community/.github/.github/workflows/chatOps.yml@master + secrets: inherit diff --git a/debian/deepin/OWNERS b/debian/deepin/OWNERS new file mode 100644 index 0000000..b834b79 --- /dev/null +++ b/debian/deepin/OWNERS @@ -0,0 +1,16 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +reviewers: +- myml +- BLumia +- Rabenda +- justforlxz +- Clansty +- chenchongbiao +approvers: +- Zeno-sole +- xzl01 +- UTsweetyfish +- hudeng-go +- zccrs +- deepin-community/deepin-sysdev-team diff --git a/debian/deepin/workflows.yml b/debian/deepin/workflows.yml new file mode 100644 index 0000000..c6c2ebf --- /dev/null +++ b/debian/deepin/workflows.yml @@ -0,0 +1,36 @@ +test_build: + steps: + - link_package: + source_project: deepin:Develop:main + source_package: %{SCM_REPOSITORY_NAME} + target_project: deepin:CI + + - configure_repositories: + project: deepin:CI + repositories: + - name: deepin_develop + paths: + - target_project: deepin:CI + target_repository: deepin_develop + architectures: + - x86_64 + - aarch64 + + filters: + event: pull_request + +tag_build: + steps: + - trigger_services: + project: deepin:Unstable:main + package: %{SCM_REPOSITORY_NAME} + filters: + event: tag_push + +commit_build: + steps: + - trigger_services: + project: deepin:Develop:main + package: %{SCM_REPOSITORY_NAME} + filters: + event: push From 54f233947f5b6194ca5ac39346d71ea74c38fd34 Mon Sep 17 00:00:00 2001 From: lichenggang Date: Thu, 3 Jul 2025 14:32:40 +0800 Subject: [PATCH 5/6] feat: update changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 16ebbc3..ec0d5c7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,12 @@ bash-pinyin-completion (0.0.2) unstable; urgency=medium bash-pinyin-completion (0.0.1) UNRELEASED; urgency=medium + * Fix completion exception. + + -- lichenggang Thu, 03 Jul 2025 14:31:32 +0800 + +bash-pinyin-completion (0.0.1) unstable; urgency=medium + * Initial release -- April Lu Thu, 12 Jun 2025 20:31:00 +0800 From 7b18cec3678a7c990b618ac8a478864f8d60d492 Mon Sep 17 00:00:00 2001 From: lichenggang Date: Wed, 9 Jul 2025 10:46:15 +0800 Subject: [PATCH 6/6] feat: update changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index ec0d5c7..16aa1be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +bash-pinyin-completion (0.0.3) unstable; urgency=medium + + * fix sshfs command tab shows multiple home. + + -- lichenggang Wed, 09 Jul 2025 10:44:25 +0800 + bash-pinyin-completion (0.0.2) unstable; urgency=medium * Move logic to C++, fix several issues