加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

bash – 如何将非拉丁gnu / make目标添加到完成列表?

发布时间:2020-12-15 21:23:45 所属栏目:安全 来源:网络整理
导读:gnu / make支持makefile中的非拉丁语标识符(f.e.,targets). 例: $cat GNUmakefiletest: @echo testтест: @echo test in russian$make test тестtesttest in russian 但是这个例子的bash-completion只完成了一个目标 – 测试: “make”选项卡→“ma
gnu / make支持makefile中的非拉丁语标识符(f.e.,targets).

例:

$cat GNUmakefile
test:
  @echo test
тест:
  @echo test in russian

$make test тест
test
test in russian

但是这个例子的bash-completion只完成了一个目标 – 测试:

“make”选项卡→“make test”.

如何将非拉丁目标添加到完成列表?

在各种分发列表(debian 5-8,ubuntu 12-15,centos 5-6,mandriva 2008)上测试了不同版本的bash-completion.

至少在最近版本的bash-completion中我需要支持这个功能.

解决方法

我找到了解决方案.

来自文件/usr/share / bash-completion / completions / make的函数_make_target_extract_script中的错误,它返回sed-script,其中包含以下行:

/^[^a-zA-Z0-9]/             d             # convention for hidden tgt

删除以非拉丁字符开头(特别是)的目标.

在我看来,这样的正则表达式会更合适(见this):

/^[^[[:alnum:]]]/             d             # convention for hidden tgt

如果你不能编辑/usr/share / bash-completion / completions / make,你可以添加到?/ .bashrc这样的行(基于this answer):

_completion_loader make
eval "$(type _make_target_extract_script | sed '1d;s/a-zA-Z0-9/[[:alnum:]]/')"

更新

我提交了bug report(不幸的是,需要注册).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读