- 
                Notifications
    You must be signed in to change notification settings 
- Fork 346
feat(): Show repo name status bar #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
940d292
              fc04286
              e4ce778
              08101b2
              d59c782
              9990a5f
              7c44e2e
              0e215d9
              960a6d2
              fe202ab
              80b3993
              389c4eb
              7de8c31
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|  | @@ -9,6 +9,7 @@ IFS=' ' read -r -a diff_symbol <<< $(get_tmux_option "@dracula-git-show-diff-sym | |||||||||||||||||||||||||
| IFS=' ' read -r -a no_repo_message <<< $(get_tmux_option "@dracula-git-no-repo-message" "") | ||||||||||||||||||||||||||
| IFS=' ' read -r -a no_untracked_files <<< $(get_tmux_option "@dracula-git-no-untracked-files" "false") | ||||||||||||||||||||||||||
| IFS=' ' read -r -a show_remote_status <<< $(get_tmux_option "@dracula-git-show-remote-status" "false") | ||||||||||||||||||||||||||
| show_repo_name="$(get_tmux_option "@dracula-git-show-repo-name" "false")" | ||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||
| # Get added, modified, updated and deleted files from git status | ||||||||||||||||||||||||||
| getChanges() | ||||||||||||||||||||||||||
|  | @@ -129,36 +130,45 @@ getRemoteInfo() | |||||||||||||||||||||||||
| echo "$out" | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||
| getRepoName() | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| if [ "$show_repo_name" = "true" ] && [ "$(checkForGitDir)" = "true" ]; then | ||||||||||||||||||||||||||
| repo="$(basename "$(git -C "$path" --no-optional-locks rev-parse --show-toplevel 2>/dev/null)")" | ||||||||||||||||||||||||||
| echo "$repo | " | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||
| # return the final message for the status bar | ||||||||||||||||||||||||||
| getMessage() | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| if [ $(checkForGitDir) == "true" ]; then | ||||||||||||||||||||||||||
| branch="$(getBranch)" | ||||||||||||||||||||||||||
| repo_name="$(getRepoName)" | ||||||||||||||||||||||||||
| output="" | ||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||
| if [ $(checkForChanges) == "true" ]; then | ||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||
| changes="$(getChanges)" | ||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||
| if [ "${hide_status}" == "false" ]; then | ||||||||||||||||||||||||||
| if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then | ||||||||||||||||||||||||||
| output=$(echo "${changes} $branch") | ||||||||||||||||||||||||||
| if [ "$(checkEmptySymbol "${diff_symbol[0]}")" = "true" ]; then | ||||||||||||||||||||||||||
| output="$repo_name${changes:+ ${changes}} $branch" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| output=$(echo "$diff_symbol ${changes} $branch") | ||||||||||||||||||||||||||
| output="$repo_name${diff_symbol[0]} ${changes:+$changes }$branch" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then | ||||||||||||||||||||||||||
| output=$(echo "$branch") | ||||||||||||||||||||||||||
| if [ "$(checkEmptySymbol "${diff_symbol[0]}")" = "true" ]; then | ||||||||||||||||||||||||||
| output=$(echo "$repo_name$branch") | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| output=$(echo "$diff_symbol $branch") | ||||||||||||||||||||||||||
| output=$(echo "$repo_name$diff_symbol $branch") | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| if [ $(checkEmptySymbol $current_symbol) == "true" ]; then | ||||||||||||||||||||||||||
| output=$(echo "$branch") | ||||||||||||||||||||||||||
| output=$(echo "$repo_name$branch") | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| output=$(echo "$current_symbol $branch") | ||||||||||||||||||||||||||
| output="$repo_name${current_symbol[0]} $branch" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| 
      Comment on lines
    
      168
     to 
      172
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 
 
 -            if [ $(checkEmptySymbol $current_symbol) == "true" ]; then
+            if [ "$(checkEmptySymbol "${current_symbol[0]}")" = "true" ]; thenMirror this fix everywhere  📝 Committable suggestion
 
        Suggested change
       
 🧰 Tools🪛 Shellcheck (0.10.0)[warning] 168-168: Quote this to prevent word splitting. (SC2046) [warning] 168-168: Expanding an array without an index only gives the first element. (SC2128) 🤖 Prompt for AI Agents | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Still expanding an array as a scalar – SC2128 resurfaces
$diff_symbolis an array; using it unindexed ("$repo_name$diff_symbol $branch") expands only the first element and revives word-splitting warnings.Update any other occurrences to keep ShellCheck quiet and behaviour predictable.
📝 Committable suggestion
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 163-163: Expanding an array without an index only gives the first element.
(SC2128)
🤖 Prompt for AI Agents