-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Description
In my workflow, I often need to apply the same tag to multiple paths at once, so I created a small Bash wrapper to support bulk tagging from a file. While doing that, a dry-run mode also felt very useful to preview what would be tagged before actually modifying anything.
I’d like to propose this functionality (or at least share the script) to see if it makes sense to be integrated or documented in the project.
Proposed functionality
- Accept a file containing paths (one per line)
- Apply a given tag to all valid directories
- Ignore empty lines and comments (
#) - Optional dry-run mode to preview actions without tagging anything
Example usage of my script:
scope-bulk <paths_file>
DRY_RUN=true scope-bulk <paths_file>
Example input file
# Services
/home/user/project/services/api
/home/user/project/services/frontend
# Infrastructure
/home/user/project/infra/dbBash script prototype
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -ne 2 ]]; then
echo "Usage: scope-bulk <paths_file> <tag>"
exit 1
fi
PATHS_FILE="$1"
TAG="$2"
DRY_RUN="${DRY_RUN:-false}"
if [[ ! -f "$PATHS_FILE" ]]; then
echo "Error: file '$PATHS_FILE' not found"
exit 1
fi
while IFS= read -r path || [[ -n "$path" ]]; do
[[ -z "$path" || "$path" =~ ^# ]] && continue
if [[ -d "$path" ]]; then
if [[ "$DRY_RUN" == "true" ]]; then
echo "[DRY-RUN] scope tag \"$path\" \"$TAG\""
else
echo "Tagging '$path' with '$TAG'"
scope tag "$path" "$TAG"
fi
else
echo "Warning: '$path' does not exist or is not a directory, skipping"
fi
done < "$PATHS_FILE"Why this could be useful
- Makes
scopeeasier to use in larger repositories - Reduces repetitive manual tagging
- Dry-run adds safety when tagging many paths at once
- Script is simple and follows standard Unix patterns
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels