Skip to content

Commit 0624caa

Browse files
committed
Refactor file pattern checks in venv.sh
1 parent e3b1744 commit 0624caa

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/venv-cli/venv.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ venv::_check_if_help_requested() {
5252
venv::_check_install_requirements_file() {
5353
### Check whether the first argument matches the pattern for a requirements file.
5454
### If not, raises error (silently if called with '-q')
55-
local file_pattern="^.*?requirements\.(txt|lock)$"
55+
local file_pattern="^.+\.(txt|lock)$"
5656
if [[ ! "$1" =~ $file_pattern ]]; then
5757
local message=""
5858
if [ "$2" != "-q" ]; then
59-
message="Input file name must have format '*requirements.txt' or '*requirements.lock', was '$1'"
59+
message="Input file name must end with '.txt' or '.lock', was '$1'"
6060
fi
6161
venv::raise "${message}"
6262
return "$?"
@@ -66,11 +66,11 @@ venv::_check_install_requirements_file() {
6666
venv::_check_lock_requirements_file() {
6767
### Check whether the first argument matches the pattern for a lock file.
6868
### If not, raises error (silently if called with '-q')
69-
local file_pattern="^.*?requirements\.lock$"
69+
local file_pattern="^.+\.lock$"
7070
if [[ ! "$1" =~ $file_pattern ]]; then
7171
local message=""
7272
if [ "$2" != "-q" ]; then
73-
message="Lock file name must have format '*requirements.lock', was '$1'"
73+
message="Lock file name must end with '.lock', was '$1'"
7474
fi
7575
venv::raise "${message}"
7676
return "$?"
@@ -227,7 +227,7 @@ venv::install() {
227227
echo "This step is skipped if '--skip-lock' or '-s' is specified, or when installing"
228228
echo "directly from a .lock-file."
229229
echo
230-
echo "The <requirements file> must be in the form '*requirements.[txt|lock]'."
230+
echo "The <requirements file> must have file extension '.txt' or '.lock'."
231231
echo "If no arguments are passed, a default file name of 'requirements.txt'"
232232
echo "will be used."
233233
echo
@@ -238,7 +238,7 @@ venv::install() {
238238
echo
239239
echo "$ venv install dev-requirements.txt"
240240
echo
241-
echo "$ venv install requirements.txt --skip-lock|-s --no-cache"
241+
echo "$ venv install requirements/dev-all.txt --skip-lock|-s --no-cache"
242242
return "${_success}"
243243
fi
244244

@@ -291,7 +291,7 @@ venv::lock() {
291291
echo "venv lock [<lock file>|<lock file prefix>]"
292292
echo
293293
echo "Lock all installed package versions and write them to <lock file>."
294-
echo "The <lock file> must be in the form '*requirements.lock'."
294+
echo "The <lock file> must have the file extension '.lock'."
295295
echo
296296
echo "If <lock file prefix> is specified instead, locks the requirements to"
297297
echo "a file called '<lock file prefix>-requirements.lock', e.g."

0 commit comments

Comments
 (0)