我有一个if声明有几个ored 参数。为了便于阅读,我将它们垂直堆叠如下。
if (health.flag_a ||
health.flag_b ||
health.flag_c ||
health.flag_d ||
health.flag_e ||
health.flag_f ||
health.flag_g ||
health.flag_h ||
health.flag_i ||
health.flag_k) {
do_something();
return false;
}
Run Code Online (Sandbox Code Playgroud)
clang-format 将其转换为:
if (health.flag_a || health.flag_b || health.flag_c || health.flag_d || health.flag_e || health.flag_f || health.flag_g || health.flag_h ||
health.flag_i || health.flag_k) {
do_something();
return false;
}
Run Code Online (Sandbox Code Playgroud)
clang-format如果它们不适合在一条线上,我想像上面那样堆叠它们。我希望BinPackArguments这样做,但我没有任何运气。
这能实现吗?
.clang-format下面看我的。
谢谢你的帮助。
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true …Run Code Online (Sandbox Code Playgroud) 我正在编写一个 bash 命令行工具,我想使用完全启用 bash 完成。
我有以下 bash 完成。在我eval "$(./cli completion)"(输出以下内容)之后,补全在 bash 中工作正常:
#!/usr/bin/env bash
# This bash completions script was generated by
# completely (https://github.com/dannyben/completely)
# Modifying it manually is not recommended
_cli_completions() {
local cur=${COMP_WORDS[COMP_CWORD]}
local comp_line="${COMP_WORDS[*]:1}"
case "$comp_line" in
'completions'*) COMPREPLY=($(compgen -W "--help -h" -- "$cur")) ;;
'download'*) COMPREPLY=($(compgen -W "--force --help -f -h" -- "$cur")) ;;
''*) COMPREPLY=($(compgen -W "--help --version -h -v completions download" -- "$cur")) ;;
esac
}
complete -F _cli_completions …Run Code Online (Sandbox Code Playgroud)