From 0edf4efb684d739dcb8c56310e24ed158ca10ec1 Mon Sep 17 00:00:00 2001 From: Rodrigo Motta Date: Sun, 1 Feb 2026 17:26:00 -0300 Subject: [PATCH 1/3] style(github): use [[ ]] for conditional tests in gh-repo-list.sh --- src/github/gh-repo-list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/github/gh-repo-list.sh b/src/github/gh-repo-list.sh index bac9156..deb5b24 100755 --- a/src/github/gh-repo-list.sh +++ b/src/github/gh-repo-list.sh @@ -18,7 +18,7 @@ function list_github_repo() { tmp_file=$(mktemp) # Get all repositories - while [ "$endpoint" ]; do + while [[ "$endpoint" ]]; do repos=$(curl --proto "=https" --tlsv1.2 -sSf -L -H "Authorization: token $GITHUB_TOKEN" "$endpoint") echo "$repos" >> "$tmp_file" From 437f6e756431bc9e80a32ecd425ebd2c846f0303 Mon Sep 17 00:00:00 2001 From: Rodrigo Motta Date: Sun, 1 Feb 2026 17:29:54 -0300 Subject: [PATCH 2/3] style(gitnap): use [[ ]] for conditional tests in gn-init-git.sh --- src/gitnap/gn-init-git.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gitnap/gn-init-git.sh b/src/gitnap/gn-init-git.sh index d53c4f4..040542c 100755 --- a/src/gitnap/gn-init-git.sh +++ b/src/gitnap/gn-init-git.sh @@ -15,14 +15,14 @@ function initialize_git_repo() { git init --initial-branch=main # Check for existing README.md file - if [ ! -f "README.md" ]; then + if [[ ! -f "README.md" ]]; then echo "# $repo" > README.md fi git add README.md # Handle optional language parameter - if [ -n "$1" ]; then + if [[ -n "$1" ]]; then # Language name from parameter language="$1" download_gitignore "$language" @@ -30,7 +30,7 @@ function initialize_git_repo() { fi # Handle optional license parameter - if [ -n "$2" ]; then + if [[ -n "$2" ]]; then # License type from parameter license="$2" download_license "$license" From a6c55ca9d263a9ed7812eed543278e49c6c9f176 Mon Sep 17 00:00:00 2001 From: Rodrigo Motta Date: Sun, 1 Feb 2026 17:38:09 -0300 Subject: [PATCH 3/3] fix(utils): redirect error messages to stderr in endpoints.sh - Updated all error/warning messages from 'echo' to 'echo >&2' - Ensures proper separation of output streams - Maintains clean stdout for pipeline processing - Follows shell scripting best practices for error handling --- src/utils/endpoints.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/endpoints.sh b/src/utils/endpoints.sh index 7c4609d..4dcbbe4 100755 --- a/src/utils/endpoints.sh +++ b/src/utils/endpoints.sh @@ -22,7 +22,7 @@ function build_bb_endpoint() { repo="$3" if [[ -z "$route" || -z "$owner" || -z "$repo" ]]; then - echo "Error: route, owner, and repository are required for Bitbucket." + echo "Error: route, owner, and repository are required for Bitbucket." >&2 exit 1 fi @@ -58,7 +58,7 @@ function build_gh_endpoint() { repo="$3" if [[ -z "$route" || -z "$owner" || -z "$repo" ]]; then - echo "Error: route, owner, and repository are required for GitHub." + echo "Error: route, owner, and repository are required for GitHub." >&2 exit 1 fi @@ -95,7 +95,7 @@ function build_gl_endpoint() { slash_encoded="%2F" if [[ -z "$route" || -z "$owner" || -z "$repo" ]]; then - echo "Error: route, owner, and repository are required for Gitlab." + echo "Error: route, owner, and repository are required for Gitlab." >&2 exit 1 fi