Skip to content

Commit

Permalink
complete: suppress errors for non-bash_completion "_parse_help"
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Dec 1, 2022
1 parent e19b796 commit 267de7f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/ChangeLog.md
Expand Up @@ -318,6 +318,7 @@
- global: quote `return $?` `#D1884` 801d14a
- canvas (`ble/canvas/trace`): fix text justification for empty lines (reported by rashil2000) `#D1894` xxxxxxx
- main: fix adjustments of bash options (reported by rashil2000) `#D1895` xxxxxxx
- complete: suppress error messages for non-bash_completion `_parse_help` (reported by nik312123) `#D1900` xxxxxxx

## Documentation

Expand Down
10 changes: 5 additions & 5 deletions lib/core-complete.sh
Expand Up @@ -4795,11 +4795,11 @@ function ble/complete/mandb:help/generate-cache {

function ble/complete/mandb:_parse_help/inject {
ble/is-function _parse_help || return 0
ble/function#advice before _parse_help 'ble/complete/mandb:_parse_help/generate-cache "${ADVICE_WORDS[1]}" "${ADVICE_WORDS[2]}"'
ble/function#advice before _longopt 'ble/complete/mandb:_parse_help/generate-cache "${ADVICE_WORDS[1]}"'
ble/function#advice before _parse_usage 'ble/complete/mandb:_parse_help/generate-cache "${ADVICE_WORDS[1]}" "${ADVICE_WORDS[2]}" usage'
function ble/complete/mandb:_parse_help/inject { return 0; }
}
ble/function#advice before _parse_help 'ble/complete/mandb:_parse_help/generate-cache "${ADVICE_WORDS[1]}" "${ADVICE_WORDS[2]}"' &&
ble/function#advice before _longopt 'ble/complete/mandb:_parse_help/generate-cache "${ADVICE_WORDS[1]}"' &&
ble/function#advice before _parse_usage 'ble/complete/mandb:_parse_help/generate-cache "${ADVICE_WORDS[1]}" "${ADVICE_WORDS[2]}" usage' &&
function ble/complete/mandb:_parse_help/inject { return 0; }
} 2>/dev/null # _parse_help が別の枠組みで定義されている事がある? #D1900

## @fn ble/string#hash-pjw text [size shift]
## @var[out] ret
Expand Down
17 changes: 17 additions & 0 deletions note.txt
Expand Up @@ -6613,6 +6613,23 @@ bash_tips

2022-12-01

* complete: `#advice: _parse_usage is not a function.` というエラーメッセージ (reported by nik312123) [#D1900]
https://github.com/akinomyoga/ble.sh/issues/251

bash_completion の新しい version を使っていると発生するのかもしれない。と思っ
たがそうでもなかった。まだこれらの関数は bash_completion の内部で改名されて
いない。つまり、_parse_help や _longopt を勝手に定義しているが _parse_usage
を定義していない外部の補完ライブラリが存在する。

? no: もしくは、古い bash_completion には _parse_usage は存在していなかった?
と思って調べてみたが _parse_usage も _parse_help も bash_completion
68f6f1c68 で同時に導入されているので片方だけが定義されていたという時期は
存在しない様に思われる。

何れにしても _parse_help という関数を勝手に定義する場合を考えると、勝手に他
の関数も定義されていると想定する訳には行かない。単にエラーを suppress する
事にした。

* 2022-10-24 rename to blerc.template [#D1899]
https://github.com/akinomyoga/ble.sh/issues/244#issuecomment-1288439503

Expand Down

0 comments on commit 267de7f

Please sign in to comment.