tools: Modify `update-locked-requirements` to take optional arguments.

This commit modifies the `update-locked-requirements` tool to take
output file path as optional arguments.
This commit is contained in:
Harshit Bansal 2017-09-25 19:02:06 +00:00 committed by Tim Abbott
parent 539ff20ec2
commit 0391619f48
1 changed files with 27 additions and 2 deletions

View File

@ -40,5 +40,30 @@ EOF
) | sponge "$output" ) | sponge "$output"
} }
compile_requirements requirements/prod.txt requirements/prod_lock.txt OUTPUT_PROD_FILE='requirements/prod_lock.txt'
compile_requirements requirements/dev.txt requirements/dev_lock.txt OUTPUT_DEV_FILE='requirements/dev_lock.txt'
# Parse arguments.
if [ $# -gt 0 ]; then
while [ "$1" != "" ]; do
case $1 in
--prod)
shift
OUTPUT_PROD_FILE="$1"
;;
--dev)
shift
OUTPUT_DEV_FILE="$1"
;;
*)
echo "Invalid arguments passed."
echo "Usage: $0 [--prod <prod-lock-file-path> --dev <dev-lock-file-path>]"
exit
;;
esac
shift
done
fi
compile_requirements requirements/prod.txt $OUTPUT_PROD_FILE
compile_requirements requirements/dev.txt $OUTPUT_DEV_FILE