make pip_add smarter!
- ID
a8a5a05- date
2023-05-23 02:34:56+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
f7995cf- message
make pip_add smarter!- changed files
1 file, 17 additions, 4 deletions
Changed files
pip_add (300) → pip_add (555)
diff --git a/pip_add b/pip_add
index 4cc696c..0e73094 100755
--- a/pip_add
+++ b/pip_add
@@ -3,13 +3,26 @@
set -o errexit
set -o nounset
-NAME="$1"
+for ARG in "$@"
+do
+ case "$ARG" in
+ # Although I import the package as 'import flask', the name of the
+ # package that gets installed with pip is 'Flask'.
+ flask)
+ NAME="Flask"
+ ;;
-# Add the new library to requirements.in
-pip freeze | grep "$NAME" >> requirements.in
+ *)
+ NAME="$ARG"
+ ;;
+ esac
+
+ # Add the new library to requirements.in
+ pip freeze | grep "$NAME" >> requirements.in
+done
# Now sort the file
-sort requirements.in > requirements.in.tmp
+cat requirements.in | sort | uniq > requirements.in.tmp
mv requirements.in.tmp requirements.in
# And rebuild the requirements.txt