Skip to content

Commit 3001b12

Browse files
committed
Update messages.
1 parent 8a6a960 commit 3001b12

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

dvm.sh

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ compare_version() {
99
get_package_data() {
1010
if [ "$(uname -m)" != 'x86_64' ]
1111
then
12-
echo 'Only x64 binaries are supported.'
12+
echo '[ERR] only x64 binaries are supported.'
1313
exit 1
1414
fi
1515

@@ -44,7 +44,7 @@ get_package_data() {
4444
DVM_TARGET_NAME='deno-x86_64-unknown-linux-gnu.zip'
4545
;;
4646
*)
47-
echo "Unsupported operating system $DVM_TARGET_OS"
47+
echo "[ERR] unsupported operating system $DVM_TARGET_OS."
4848
exit 1
4949
;;
5050
esac
@@ -66,21 +66,21 @@ get_latest_version() {
6666

6767
if [ ! -x "$(command -v curl)" ]
6868
then
69-
echo "Curl is required."
69+
echo "[ERR] curl is required."
7070
exit 1
7171
fi
7272

7373
if ! response=$(curl -s "$latest_url")
7474
then
75-
echo "failed to getting deno latest version"
75+
echo "[ERR] failed to getting deno latest version."
7676
exit 1
7777
fi
7878

7979
tag_name=$(echo "$response" | grep tag_name | cut -d '"' -f 4)
8080

8181
if [ -z "$tag_name" ]
8282
then
83-
echo "failed to getting deno latest version"
83+
echo "[ERR] failed to getting deno latest version."
8484
exit 1
8585
fi
8686

@@ -115,7 +115,7 @@ download_file() {
115115
then
116116
cmd="curl -LJ $url -o $temp_file"
117117
else
118-
echo "wget or curl is required."
118+
echo "[ERR] wget or curl is required."
119119
exit 1
120120
fi
121121

@@ -136,7 +136,7 @@ download_file() {
136136
rm "$temp_file"
137137
fi
138138

139-
echo "Failed to download deno $version."
139+
echo "[ERR] failed to download deno $version."
140140
exit 1
141141
}
142142

@@ -160,7 +160,7 @@ extract_file() {
160160
gunzip -c "$DVM_DIR/download/$1/deno.zip" > "$target_dir/deno"
161161
chmod +x "$target_dir/deno"
162162
else
163-
echo "unzip is required."
163+
echo "[ERR] unzip is required."
164164
exit 1
165165
fi
166166
;;
@@ -170,7 +170,7 @@ extract_file() {
170170
gunzip -c "$DVM_DIR/download/$1/deno.gz" > "$target_dir/deno"
171171
chmod +x "$target_dir/deno"
172172
else
173-
echo "gunzip is required."
173+
echo "[ERR] gunzip is required."
174174
exit 1
175175
fi
176176
;;
@@ -192,21 +192,21 @@ validate_remote_version() {
192192

193193
if [ ! -x "$(command -v curl)" ]
194194
then
195-
echo "curl is required."
195+
echo "[ERR] curl is required."
196196
exit 1
197197
fi
198198

199199
if ! response=$(curl -s "$tag_url")
200200
then
201-
echo "Failed to getting deno $version data"
201+
echo "[ERR] failed to getting deno $version data."
202202
exit 1
203203
fi
204204

205205
tag_name=$(echo "$response" | grep tag_name | cut -d '"' -f 4)
206206

207207
if [ -z "$tag_name" ]
208208
then
209-
echo "Deno '$version' not found, use 'ls-remote' command to get available versions."
209+
echo "[ERR] deno '$version' not found, use 'ls-remote' command to get available versions."
210210
exit 1
211211
fi
212212
}
@@ -224,7 +224,7 @@ install_version() {
224224

225225
if [ -f "$DVM_DIR/versions/$version/deno" ]
226226
then
227-
echo "deno $version has been installed."
227+
echo "Deno $version has been installed."
228228
exit 0
229229
fi
230230

@@ -242,7 +242,7 @@ install_version() {
242242

243243
extract_file "$version"
244244

245-
echo "deno $version has installed."
245+
echo "Deno $version has installed."
246246
}
247247

248248
uninstall_version() {
@@ -259,9 +259,9 @@ uninstall_version() {
259259
then
260260
rm -rf "$DVM_DIR/versions/$DVM_TARGET_VERSION"
261261

262-
echo "uninstalled deno $DVM_TARGET_VERSION."
262+
echo "Uninstalled deno $DVM_TARGET_VERSION."
263263
else
264-
echo "deno $DVM_TARGET_VERSION is not installed."
264+
echo "Deno $DVM_TARGET_VERSION is not installed."
265265
fi
266266
}
267267

@@ -339,13 +339,13 @@ list_remote_versions() {
339339
do
340340
if [ ! -x "$(command -v curl)" ]
341341
then
342-
echo "Curl is required."
342+
echo "[ERR] curl is required."
343343
exit 1
344344
fi
345345

346346
if ! response=$(curl -s "$releases_url&page=$page")
347347
then
348-
echo "failed to list remote versions"
348+
echo "[ERR] failed to list remote versions."
349349
exit 1
350350
fi
351351

@@ -430,7 +430,7 @@ get_version() {
430430

431431
if [ ! -f "./.dvmrc" ]
432432
then
433-
echo "No .dvmrc file found"
433+
echo "No .dvmrc file found."
434434
return
435435
fi
436436

@@ -480,9 +480,9 @@ use_version() {
480480
# create a new symbolic link, and link to specified deno executable file.
481481
ln -sf "$target_path" "$DVM_BIN/deno"
482482

483-
echo "using deno $DVM_TARGET_VERSION now."
483+
echo "Using deno $DVM_TARGET_VERSION now."
484484
else
485-
echo "deno $DVM_TARGET_VERSION is not installed."
485+
echo "Deno $DVM_TARGET_VERSION is not installed, please run 'dvm install $DVM_TARGET_VERSION' to install."
486486
exit 1
487487
fi
488488
}
@@ -520,7 +520,7 @@ set_alias() {
520520

521521
if [ ! -f "$DVM_DIR/versions/$version/deno" ]
522522
then
523-
echo "deno $version is not installed."
523+
echo "[ERR] deno $version is not installed."
524524
exit 1
525525
fi
526526

@@ -539,7 +539,7 @@ rm_alias() {
539539

540540
if [ ! -f "$DVM_DIR/aliases/$alias_name" ]
541541
then
542-
echo "Alias $alias_name does not exist."
542+
echo "[ERR] alias $alias_name does not exist."
543543
exit 1
544544
fi
545545

@@ -548,17 +548,17 @@ rm_alias() {
548548
rm "$DVM_DIR/aliases/$alias_name"
549549

550550
echo "Deleted alias $alias_name."
551-
echo "Restore it with 'dvm alias $alias_name $aliased_version'"
551+
echo "Restore it with 'dvm alias $alias_name $aliased_version'."
552552
}
553553

554554
run_with_version() {
555555
if [ ! -f "$DVM_DIR/versions/$DVM_TARGET_VERSION/deno" ]
556556
then
557-
echo "deno $DVM_TARGET_VERSION is not installed."
557+
echo "[ERR] deno $DVM_TARGET_VERSION is not installed."
558558
exit 1
559559
fi
560560

561-
echo "Running with deno $DVM_TARGET_VERSION"
561+
echo "Running with deno $DVM_TARGET_VERSION."
562562

563563
"$DVM_DIR/versions/$DVM_TARGET_VERSION/deno" "$@"
564564
}
@@ -581,7 +581,7 @@ locate_version() {
581581
then
582582
echo "$DVM_DIR/versions/$target_version/deno"
583583
else
584-
echo "deno $target_version is not installed."
584+
echo "Deno $target_version is not installed."
585585
fi
586586
}
587587

@@ -605,13 +605,13 @@ get_dvm_latest_version() {
605605

606606
if [ ! -x "$(command -v curl)" ]
607607
then
608-
echo "Curl is required."
608+
echo "[ERR] curl is required."
609609
exit 1
610610
fi
611611

612612
if ! response=$(curl -s "$request_url")
613613
then
614-
echo "failed to get the latest DVM version."
614+
echo "[ERR] failed to get the latest DVM version."
615615
exit 1
616616
fi
617617

@@ -621,7 +621,7 @@ get_dvm_latest_version() {
621621
update_dvm() {
622622
if ! cd "$DVM_DIR" 2>/dev/null
623623
then
624-
echo "Failed to update dvm."
624+
echo "[ERR] failed to update dvm."
625625
exit 1
626626
fi
627627

@@ -994,7 +994,7 @@ dvm() {
994994
mode="fix"
995995
;;
996996
*)
997-
echo "Unsupprot option \"$1\""
997+
echo "[ERR] unsupprot option \"$1\"."
998998
exit 1
999999
;;
10001000
esac
@@ -1030,7 +1030,7 @@ dvm() {
10301030

10311031
;;
10321032
*)
1033-
echo "Unknown command $1"
1033+
echo "[ERR] unknown command $1."
10341034
print_help
10351035

10361036
exit 1

0 commit comments

Comments
 (0)