style(bash): use consistent coding style#1528
Merged
ellie merged 6 commits intoatuinsh:mainfrom Jan 9, 2024
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Initially, in this file, the first level is indented by four spaces, and additional levels are indented by adding two spaces. However, this does not seem intentional because the other files, such as atuin.zsh, are consistently indented by four spaces for any levels. The indentation was gradually fixed to use four spaces when the relevant code is updated, but there are still remaining parts using two spaces. In this patch, the remaining parts are updated to use the consistent indentation of four spaces.
On the right-hand sides of assignments, the quoting of the variable expansions are not needed because they are not subject to the word splitting and the pathname expansions.
In the conditional commands [[ ... ]], the words are not subject to the word splitting and the pathname expansions, so we do not need to quote the expansions except for the right-hand sides of ==, !=, and =~, where the quoting has a special meaning. In the first place, the syntax [[ .. ]] is introduced to resolve the issue of the quoting, so it is natural to use the unquoted form inside [[ ... ]] by default. In this patch, we use the unquoted form of expansions.
This is also the format that Bash outputs with `bash --pretty-print FILE` or `declare -f FUNC`.
Contributor
Author
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is just a cosmetic one. I originally planned to submit this after settling all the planned PRs, but some would overlap. I still have two planned PRs, but I'd like to submit this before those two.
Different coding styles and indentations are mixed in the current
atuin.bash. In this PR, I try to normalize them. I separate the commits for each topic. These are more or less preferences, so if you would like the normalization the other way around, please specify it. I can adjust them (after the confirmation about the consequences if needed).As usual, I left descriptions in commit messages.