Skip to content

Instantly share code, notes, and snippets.

@tgolsson
Last active November 10, 2022 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgolsson/3b5b6c650ebddb75092b3bd115f616bc to your computer and use it in GitHub Desktop.
Save tgolsson/3b5b6c650ebddb75092b3bd115f616bc to your computer and use it in GitHub Desktop.
Pants command
#!/usr/bin/env bash
find_parent_pants() {
path="$1"
while [ `realpath "$path"` != "/" ]; do
if [[ -f "$path/pants.toml" ]] ; then
if [[ -f "$path/pants_with_source" ]] ; then
echo "$path/pants_with_source"
else
echo "$path/pants"
fi
return 0
fi
path="$path/.."
done
return 1
}
pants=$(find_parent_pants ".")
if [[ $? -ne 0 ]]; then
echo "Not in a pants workspace: no pants.toml found in this or parent directories"
exit 1
fi
"$pants" $@
@tgolsson
Copy link
Author

New version 2022-11-10 to support pants_with_source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment