orchestra: pre-release WIP snapshot (orchestra-06g4a4f0tfxkzhje48n05xn1hg-73a2e4fd)
This commit is contained in:
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
WORKTREES=/tmp/test-e2e-worktrees
|
||||
REPO=/tmp/test-e2e
|
||||
|
||||
main() {
|
||||
json=0
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--help)
|
||||
printf 'Usage: %s [--json]\n\n' "${0##*/}"
|
||||
printf 'Reports on the local Orchestra worktree layout.\n'
|
||||
printf 'Prints a human-readable summary by default, or one JSON object with --json.\n'
|
||||
exit 0
|
||||
;;
|
||||
--json)
|
||||
json=1
|
||||
;;
|
||||
*)
|
||||
printf 'unknown argument: %s\n' "$arg" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -d "$WORKTREES" ]; then
|
||||
exists=true
|
||||
count=$(ls -A "$WORKTREES" 2>/dev/null | wc -l)
|
||||
else
|
||||
exists=false
|
||||
count=0
|
||||
fi
|
||||
|
||||
if [ -d "$REPO/.git" ]; then
|
||||
is_git=true
|
||||
else
|
||||
is_git=false
|
||||
fi
|
||||
|
||||
if [ "$json" = 1 ]; then
|
||||
printf '{"worktrees_dir":"%s","worktrees_dir_exists":%s,"worktrees_entries":%s,"repo":"%s","repo_is_git":%s}\n' \
|
||||
"$WORKTREES" "$exists" "$count" "$REPO" "$is_git"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf '%s exists: %s\n' "$WORKTREES" "$exists"
|
||||
printf '%s entries: %s\n' "$WORKTREES" "$count"
|
||||
printf '%s is a git repository: %s\n' "$REPO" "$is_git"
|
||||
exit 0
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user