From 7536b39363d695167afca587a904f0ced1d50bde Mon Sep 17 00:00:00 2001 From: "rmotta.net:~#" <114815819+rmottanet@users.noreply.github.com> Date: Sun, 26 Oct 2025 19:22:17 -0300 Subject: [PATCH] CHORE: Enhance script quality and error handling (#4) Implement the standard `#!/usr/bin/env bash` for portability and `set -euo pipefail` for more rigorous error handling (fail-fast, defined variables, and pipeline check) across the entire script suite. --- src/bitbucket/bb-pr-create.sh | 1 + src/bitbucket/bb-pr-merge.sh | 1 + src/bitbucket/bb-pr-update.sh | 1 + src/bitbucket/bb-repo-create.sh | 1 + src/bitbucket/bb-repo-delete.sh | 1 + src/bitbucket/bb-repo-edit.sh | 1 + src/github/gh-notification-delete.sh | 1 + src/github/gh-notification-list.sh | 1 + src/github/gh-pr-create.sh | 1 + src/github/gh-pr-merge.sh | 1 + src/github/gh-pr-update.sh | 1 + src/github/gh-repo-create.sh | 1 + src/github/gh-repo-delete.sh | 1 + src/github/gh-repo-edit.sh | 1 + src/github/gh-search-repo.sh | 0 src/gitlab/gl-pr-create.sh | 1 + src/gitlab/gl-pr-merge.sh | 1 + src/gitlab/gl-pr-update.sh | 1 + src/gitlab/gl-repo-create.sh | 1 + src/gitlab/gl-repo-delete.sh | 1 + src/gitlab/gl-repo-edit.sh | 1 + src/gitlab/gl-search-repo.sh | 1 + src/gitnap/gn-init-git.sh | 1 + src/utils/auth.sh | 0 src/utils/down_gitignore.sh | 1 + src/utils/down_license.sh | 1 + src/utils/endpoints.sh | 0 27 files changed, 24 insertions(+) mode change 100644 => 100755 src/bitbucket/bb-pr-create.sh mode change 100644 => 100755 src/bitbucket/bb-pr-merge.sh mode change 100644 => 100755 src/bitbucket/bb-repo-create.sh mode change 100644 => 100755 src/bitbucket/bb-repo-delete.sh mode change 100644 => 100755 src/bitbucket/bb-repo-edit.sh mode change 100644 => 100755 src/github/gh-pr-merge.sh mode change 100644 => 100755 src/github/gh-search-repo.sh mode change 100644 => 100755 src/gitlab/gl-pr-merge.sh mode change 100644 => 100755 src/gitlab/gl-search-repo.sh mode change 100644 => 100755 src/utils/auth.sh mode change 100644 => 100755 src/utils/endpoints.sh diff --git a/src/bitbucket/bb-pr-create.sh b/src/bitbucket/bb-pr-create.sh old mode 100644 new mode 100755 index 7b7c10e..7e8c9b1 --- a/src/bitbucket/bb-pr-create.sh +++ b/src/bitbucket/bb-pr-create.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Authentication and default settings source "$GITNAP/utils/auth.sh" diff --git a/src/bitbucket/bb-pr-merge.sh b/src/bitbucket/bb-pr-merge.sh old mode 100644 new mode 100755 index 600b79d..453368f --- a/src/bitbucket/bb-pr-merge.sh +++ b/src/bitbucket/bb-pr-merge.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Authentication and default settings source "$GITNAP/utils/auth.sh" diff --git a/src/bitbucket/bb-pr-update.sh b/src/bitbucket/bb-pr-update.sh index 5d085f3..58165a7 100755 --- a/src/bitbucket/bb-pr-update.sh +++ b/src/bitbucket/bb-pr-update.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Authentication and default settings source "$GITNAP/utils/auth.sh" diff --git a/src/bitbucket/bb-repo-create.sh b/src/bitbucket/bb-repo-create.sh old mode 100644 new mode 100755 index 8d1f410..7d1c457 --- a/src/bitbucket/bb-repo-create.sh +++ b/src/bitbucket/bb-repo-create.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Construct basic authentication header diff --git a/src/bitbucket/bb-repo-delete.sh b/src/bitbucket/bb-repo-delete.sh old mode 100644 new mode 100755 index 6f2e9bc..dc0c6ff --- a/src/bitbucket/bb-repo-delete.sh +++ b/src/bitbucket/bb-repo-delete.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Construct basic authentication header diff --git a/src/bitbucket/bb-repo-edit.sh b/src/bitbucket/bb-repo-edit.sh old mode 100644 new mode 100755 index d92275c..9e421e1 --- a/src/bitbucket/bb-repo-edit.sh +++ b/src/bitbucket/bb-repo-edit.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Construct basic authentication header diff --git a/src/github/gh-notification-delete.sh b/src/github/gh-notification-delete.sh index 50fcceb..3455f8d 100755 --- a/src/github/gh-notification-delete.sh +++ b/src/github/gh-notification-delete.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # This section loads configuration files needed to set environment variables # such as GITHUB_TOKEN. If these variables are already exported globally in the shell, diff --git a/src/github/gh-notification-list.sh b/src/github/gh-notification-list.sh index 3d335e9..7d7c13d 100755 --- a/src/github/gh-notification-list.sh +++ b/src/github/gh-notification-list.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # This section loads configuration files needed to set environment variables # such as GITHUB_TOKEN. If these variables are already exported globally in the shell, diff --git a/src/github/gh-pr-create.sh b/src/github/gh-pr-create.sh index 94581d9..7331a7b 100755 --- a/src/github/gh-pr-create.sh +++ b/src/github/gh-pr-create.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Authentication and default settings source "$GITNAP/utils/auth.sh" diff --git a/src/github/gh-pr-merge.sh b/src/github/gh-pr-merge.sh old mode 100644 new mode 100755 index 71e9bac..1817dfe --- a/src/github/gh-pr-merge.sh +++ b/src/github/gh-pr-merge.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Authentication and default settings source "$GITNAP/utils/auth.sh" diff --git a/src/github/gh-pr-update.sh b/src/github/gh-pr-update.sh index a40eb64..b2482ca 100755 --- a/src/github/gh-pr-update.sh +++ b/src/github/gh-pr-update.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Authentication and default settings source "$GITNAP/utils/auth.sh" diff --git a/src/github/gh-repo-create.sh b/src/github/gh-repo-create.sh index 6a529ea..e0b2caa 100755 --- a/src/github/gh-repo-create.sh +++ b/src/github/gh-repo-create.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail function create_github_repo() { diff --git a/src/github/gh-repo-delete.sh b/src/github/gh-repo-delete.sh index e1fcafa..28a4bad 100755 --- a/src/github/gh-repo-delete.sh +++ b/src/github/gh-repo-delete.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail function delete_github_repo() { diff --git a/src/github/gh-repo-edit.sh b/src/github/gh-repo-edit.sh index deca4e4..c9729fe 100755 --- a/src/github/gh-repo-edit.sh +++ b/src/github/gh-repo-edit.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail function edit_github_repo() { diff --git a/src/github/gh-search-repo.sh b/src/github/gh-search-repo.sh old mode 100644 new mode 100755 diff --git a/src/gitlab/gl-pr-create.sh b/src/gitlab/gl-pr-create.sh index 7766d3f..29daecb 100755 --- a/src/gitlab/gl-pr-create.sh +++ b/src/gitlab/gl-pr-create.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Authentication and default settings source "$GITNAP/utils/auth.sh" diff --git a/src/gitlab/gl-pr-merge.sh b/src/gitlab/gl-pr-merge.sh old mode 100644 new mode 100755 index 15e0bcc..931108e --- a/src/gitlab/gl-pr-merge.sh +++ b/src/gitlab/gl-pr-merge.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Authentication and default settings source "$GITNAP/utils/auth.sh" diff --git a/src/gitlab/gl-pr-update.sh b/src/gitlab/gl-pr-update.sh index 427c01e..756b6eb 100755 --- a/src/gitlab/gl-pr-update.sh +++ b/src/gitlab/gl-pr-update.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # Authentication and default settings source "$GITNAP/utils/auth.sh" diff --git a/src/gitlab/gl-repo-create.sh b/src/gitlab/gl-repo-create.sh index 6a27acf..344ef60 100755 --- a/src/gitlab/gl-repo-create.sh +++ b/src/gitlab/gl-repo-create.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail function create_gitlab_repo() { diff --git a/src/gitlab/gl-repo-delete.sh b/src/gitlab/gl-repo-delete.sh index 9603e08..9b8de01 100755 --- a/src/gitlab/gl-repo-delete.sh +++ b/src/gitlab/gl-repo-delete.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail function delete_gitlab_repo() { diff --git a/src/gitlab/gl-repo-edit.sh b/src/gitlab/gl-repo-edit.sh index 30bcdab..d56aa30 100755 --- a/src/gitlab/gl-repo-edit.sh +++ b/src/gitlab/gl-repo-edit.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail function edit_gitlab_repo() { diff --git a/src/gitlab/gl-search-repo.sh b/src/gitlab/gl-search-repo.sh old mode 100644 new mode 100755 index d22ca41..685fbc5 --- a/src/gitlab/gl-search-repo.sh +++ b/src/gitlab/gl-search-repo.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail function search_gitlab_repo() { diff --git a/src/gitnap/gn-init-git.sh b/src/gitnap/gn-init-git.sh index 8997db9..e26c03e 100755 --- a/src/gitnap/gn-init-git.sh +++ b/src/gitnap/gn-init-git.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail source "$GITNAP/utils/down_gitignore.sh" source "$GITNAP/utils/down_license.sh" diff --git a/src/utils/auth.sh b/src/utils/auth.sh old mode 100644 new mode 100755 diff --git a/src/utils/down_gitignore.sh b/src/utils/down_gitignore.sh index 6019a83..e27ca89 100755 --- a/src/utils/down_gitignore.sh +++ b/src/utils/down_gitignore.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail function download_gitignore() { diff --git a/src/utils/down_license.sh b/src/utils/down_license.sh index 1709fda..494ff2d 100755 --- a/src/utils/down_license.sh +++ b/src/utils/down_license.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail function download_license() { diff --git a/src/utils/endpoints.sh b/src/utils/endpoints.sh old mode 100644 new mode 100755