Skip to content

添加 .editorconfig 配置,约束 *.sh 文件格式#1248

Open
abcfy2 wants to merge 1 commit intojuewuy:devfrom
abcfy2:dev
Open

添加 .editorconfig 配置,约束 *.sh 文件格式#1248
abcfy2 wants to merge 1 commit intojuewuy:devfrom
abcfy2:dev

Conversation

@abcfy2
Copy link
Contributor

@abcfy2 abcfy2 commented Mar 26, 2026

  • 添加 .editorconfig 配置,shfmt 以及常见的编辑器应该都会遵循
  • 修正 scripts/starts/snapshot_init.sh 的检测错误: scripts/starts/snapshot_init.sh:31:18: &> redirects are a bash/mksh/zsh feature; tried parsing as posix,为了保证脚本的兼容性,应该使用 POSIX 语法而非特定 shell 的特殊语法
  • 使用 shfmt 格式化修改过的文件

具体格式定义:

  • 使用 4 空格 缩进而非 TAB 缩进
  • 使用 posix 语法检测
  • 语法简化
  • case 语句同样缩进

未来遇到需要格式化的地方只需要使用 shfmt -w /path/to/file 即可,格式化整个项目只需要 shfmt -w .,为了防止一次性修改太多就不执行这个了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant