11#! /usr/bin/env bash
2- # Shell completion for Deno Version Manager
2+
3+ # Bash completion for Deno Version Manager
34# Copyright (C) 2020 ~ 2025, Chen Su and all contributors.
45
56if ! type dvm & > /dev/null
67then
78 return
89fi
910
10- # Add available aliases into auto-completion options list.
11+ # Add available aliases to the auto-completion options list.
1112_dvm_add_aliases_to_opts () {
1213 if [ ! -d " $DVM_DIR /aliases" ]
1314 then
@@ -31,7 +32,7 @@ _dvm_add_aliases_to_opts() {
3132 done
3233}
3334
34- # Add commands and top-level option (--help and --version) to options.
35+ # Add commands and top-level options (--help and --version) to the options list .
3536_dvm_add_command_and_top_option () {
3637 if [[ ${cur} == -* ]]
3738 then
@@ -42,22 +43,22 @@ _dvm_add_command_and_top_option() {
4243 fi
4344}
4445
45- # Add the specified options into the options list if no one was inputted .
46+ # Add the specified options to the options list if none have been input yet .
4647_dvm_add_exclusive_option () {
4748 if _dvm_no_option_input " ${@ } "
4849 then
4950 opts=" $opts $* "
5051 fi
5152}
5253
53- # Add options for command install.
54+ # Add options for the install command .
5455_dvm_add_install_option () {
5556 _dvm_add_exclusive_option " --from-binary" " --from-source"
5657 _dvm_add_options " --registry=" " --skip-validation" " --skip-download-cache"
5758 _dvm_add_options " --sha256sum" " --no-sha256sum"
5859}
5960
60- # Add the specified option to the options list.
61+ # Add the specified options to the options list.
6162_dvm_add_options () {
6263 for opt in " ${@ } "
6364 do
@@ -68,7 +69,7 @@ _dvm_add_options() {
6869 done
6970}
7071
71- # Add common options into auto-completion options list.
72+ # Add common options to the auto-completion options list.
7273_dvm_add_options_to_opts () {
7374 local prev
7475
@@ -89,7 +90,7 @@ _dvm_add_options_to_opts() {
8990 _dvm_add_options " --verbose"
9091}
9192
92- # Add available installed versions into auto-completion options list.
93+ # Add available installed versions to the auto-completion options list.
9394_dvm_add_versions_to_opts () {
9495 if [ ! -d " $DVM_DIR /versions" ]
9596 then
@@ -112,7 +113,7 @@ _dvm_add_versions_to_opts() {
112113 done
113114}
114115
115- # Set auto-completion with specific command.
116+ # Set auto-completion for a specific command.
116117_dvm_completion () {
117118 local command
118119 local cur
@@ -175,12 +176,12 @@ _dvm_completion() {
175176 COMPREPLY=( " $( compgen -W " ${opts} " -- " ${cur} " ) " )
176177}
177178
178- # Check if any Deno version has been activated that installed by DVM.
179+ # Check if any Deno version installed by DVM is currently active .
179180_dvm_has_active_version () {
180181 echo " $PATH " | grep -q " $DVM_DIR /versions"
181182}
182183
183- # Checks whether the parameters list have non-option parameter or not .
184+ # Check whether the parameter list contains any non-option parameters .
184185_dvm_has_non_option_parameter () {
185186 local cur
186187 cur=" $1 "
@@ -202,7 +203,7 @@ _dvm_has_non_option_parameter() {
202203 false
203204}
204205
205- # Check whether the specified options are inputted or not
206+ # Check whether the specified options have been input.
206207_dvm_no_option_input () {
207208 for opt in " ${@ } "
208209 do
0 commit comments