From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 28247 invoked from network); 14 Nov 2023 00:16:23 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Nov 2023 00:16:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:From:Reply-To:Cc: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=tFCorVIrBdgB9sm8qmcgZJb52piyYtQ+OqSSXGhVW2U=; b=FqgG9Dmp2eEA4P40vSZNbcHWr3 gv8Pci7dvKDVKPhlmjs5sVNQsCJuh3+9rToO4wYvjy9goUfQ3UV9B4ZjJ0gWvczPm1afgY21uTmJt 0vCOg6TBhxSn0KKvQ7ycD4CcdDKk01eC4vX1JMa0KZXJ3gdeb2RU4cfPJX5BkXbUkr64RxFnYhuu3 6syf2incumAZu62aHJEzhkp5d61TecQdf+bN+I64VBNmLzAUt5dGu48aHxbX50HAX4KVCYfvFQFe9 9ZCBWeyqN8E4iU9Bt5OTL3ExmzCmvzDGGrNIMiLhFPLSG0JPCvHUVKQEvrjwdqJRBlPpLJeP8OnSX CmpAo2Yw==; Received: by zero.zsh.org with local id 1r2h6M-0006nY-KK; Tue, 14 Nov 2023 00:16:22 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1r2h61-0006T6-Hk; Tue, 14 Nov 2023 00:16:01 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.95) (envelope-from ) id 1r2h60-000CUA-UR for zsh-workers@zsh.org; Tue, 14 Nov 2023 01:16:01 +0100 From: Oliver Kiddle To: Zsh workers Subject: PATCH: update to ruby completions MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <47996.1699920960.1@hydra> Date: Tue, 14 Nov 2023 01:16:00 +0100 Message-ID: <47997-1699920960.940287@MSVr.zxWy.iwZk> X-Seq: 52301 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: This updates options in the completions for gem 3.4.10, ruby 3.2.2 and ri 6.5.0. Oliver diff --git a/Completion/Unix/Command/_gem b/Completion/Unix/Command/_gem index 7d81619bb..c5a64cdf1 100644 --- a/Completion/Unix/Command/_gem +++ b/Completion/Unix/Command/_gem @@ -20,6 +20,7 @@ lropts=( $proxy _arguments -C -s \ '(* -)'{-h,--help}'[display usage information]' \ '(* -)'{-v,--version}'[display version information]' \ + '-C[change directory first]:directory:_directories' \ '*::command:->command' && ret=0 if [[ $state = command ]]; then @@ -27,7 +28,7 @@ if [[ $state = command ]]; then cmd=subcommands else cmds=( - build cert check cleanup contents dependency environment fetch + build cert check cleanup contents dependency environment exec fetch generate_index help install info list lock mirror open outdated owner pristine push query rdoc search server signin signout sources specification stale uninstall unpack update which yank @@ -87,13 +88,13 @@ if [[ $state = command ]]; then '!(-d --details)--no-details' ) ;| - check|contents|dependency|fetch|install|list|open|pristine|query|rdoc|search|specification|uninstall|unpack|yank) + check|contents|dependency|exec|fetch|install|list|open|pristine|query|rdoc|search|specification|uninstall|unpack|yank) args+=( '(-v --version)'{-v,--version=}'[specify version of gem]:version' ) ;| - dependency|fetch|install|outdated|specification|uninstall|update|yank) + build|dependency|fetch|install|outdated|specification|uninstall|update|yank) args+=( '--platform=[specify the platform of gem]:platform' ) ;| - dependency|fetch|install|list|query|search|specification|update) + dependency|exec|fetch|install|list|query|search|specification|update) args+=( '--prerelease[include prerelease versions of a gem]' '!(--prerelease)--no-prerelease' ) ;| install|unpack|update) @@ -125,13 +126,13 @@ if [[ $state = command ]]; then ;| (un|)install|pristine|update) args+=( + '(-i --install-dir)'{-i,--install-dir=}'[specify gem repository directory to get installed gems]:directory:_directories' '(-n --bindir)'{-n,--bindir=}'[specify directory where binary files are located]:directory:_directories' ) ;| (un|)install|update) args+=( '--ignore-dependencies[ignore dependency requirements]' - '(-i --install-dir)'{-i,--install-dir=}'[specify gem repository directory to get installed gems]:directory:_directories' ) ;| owner|push) @@ -166,6 +167,7 @@ if [[ $state = command ]]; then '(-b --build)'{-b,--build=}'[build private key and self-signed certificate for specified email address]:email address:_email_addresses -c' '(-C --certificate)'{-C,--certificate=}'[specify signing certificate for --sign]:certificate' '(-K --private-key)'{-K,--private-key=}'[specify key for --sign or --build]:key' + '(-A --key-algorithm)'{-A,--key-algorithm=}'[select which key algorithm to use for --build]:algorithm' '(-s --sign)'{-s,--sign=}'[sign specified certificate with the key from -K and the certificate from -C]:certificate' '(-d --days)'{-d,--days=}'[specify days before certificate expires]:days' '(-R --re-sign)'{-R,--re-sign}'[re-sign the certificate]' @@ -181,7 +183,7 @@ if [[ $state = command ]]; then ;; cleanup) args+=( - '(-n -d --dryrun)'{-n,-d,--dryrun}"[don't uninstall gems]" + '(-n -d --dry-run)'{-n,-d,--dry-run}"[don't uninstall gems]" "--user-install[cleanup in user's home directory instead of GEM_HOME]" ) ;; @@ -201,11 +203,20 @@ if [[ $state = command ]]; then ) ;; environment) - args+=( '1:information:(gemdir gempath version remotesources platform)' ) + args+=( '1:information:(gemdir gempath home path user_gemhome version remotesources platform)' ) + ;; + exec) + args+=( + '--conservative[prefer most recent installed version to the overall latest]' + '1:gem:->gems-remote' + '*: :_default' + ) ;; fetch) def=( both \! local \! remote \! ) - args+=( ${(e)lropts} ) + args+=( ${(e)lropts} + "--no-suggestions[don't suggest alternates when gems are not found]" + ) ;; generate_index) args+=( @@ -232,13 +243,15 @@ if [[ $state = command ]]; then args+=( '(*)*--skip=[with --all, skip specified gem]:installed gem:->gems-local' "--no-extensions[don't restore gems with extensions in addition to regular gems]" + '--only-missing-extensions[only restore gems with missing extensions]' '--only-executables[only restore executables]' + '--only-plugins[only restore plugins]' ) ;; push) args+=( '1:gem file:_files -g "*.gem(-.)"' ) ;; - query) + query) # deprecated args+=( '(-n --name-matches)'{-n,--name-matches=}'[specify regex to match against gem names]:gem name (regex):->gems-local' ) @@ -266,6 +279,7 @@ if [[ $state = command ]]; then '(-r --remove)'{-r,--remove=}'[remove source]:source URI:_urls' '(-c --clear-all)'{-c,--clear-all}'[remove all sources (clear the cache)]' '(-u --update)'{-u,--update}'[update source cache]' + '(-f --force)'{-f,--force}"[don't show any confirmation prompts]" ) ;; specification) @@ -319,7 +333,7 @@ if [[ $state = command ]]; then '--norc[avoid loading any .gemrc file]' && ret=0 if [[ $state == gems* ]]; then - filter=( ${${opt_args[(I)-([lbr]|-local|-remote|-both)]}:-${${(M)state:#*-*}/gems-/--}} ) + filter=( ${${opt_args[(I)-([lbr]|-conservative|-local|-remote|-both)]/conservative/local}:-${${(M)state:#*-*}/gems-/--}} ) _description gems expl gem compadd "$expl[@]" ${${(f)"$(_call_program gems gem list $filter -q --no-versions)"}%% *} && ret=0 fi diff --git a/Completion/Unix/Command/_ri b/Completion/Unix/Command/_ri index 4d5a72985..28de7a9a9 100644 --- a/Completion/Unix/Command/_ri +++ b/Completion/Unix/Command/_ri @@ -26,33 +26,22 @@ _arguments -C \ '*:ri name:->ri-name' && return if [[ "$state" = ri-name ]]; then - local -a ri_dirs ri_ext ri_names ri_wants ri_names + local -a ri_dirs ri_names ri_wants ri_names local class_dir esc_name dir curtag tag descr expl - if "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e 1 >/dev/null 2>&1; then - # Old-style Ruby 1.8.x RI - ri_dirs=( ${(f)"$(_call_program ri-names "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e '"o = RI::Options.instance; o.parse(ARGV); o.path.each { |p| puts p }"' -- ${(kv)opt_args[(I)-d|--doc-dir|--(system|site|gems|home)]})"} ) - ri_ext=yaml - elif "ruby${words[1]#ri}" -rrdoc/ri -rrdoc/ri/store -e 1 >/dev/null 2>&1; then - # Newer-style Ruby 1.9.2 RI - ri_dirs=( ${(f)"$(_call_program ri-names "$words[1]" ${(kv)opt_args[(I)-d|--doc-dir|--((no-|)(system|site|gems|home)|standard-docs)]} --list-doc-dirs -f bs -T)"} ) - ri_ext=ri - else - # New-style Ruby 1.9+ RI - ri_dirs=( ${(f)"$(_call_program ri-names "$words[1]" ${(kv)opt_args[(I)-d|--doc-dir|--((no-|)(system|site|gems|home)|standard-docs)]} --list-doc-dirs -f plain -T)"} ) - ri_ext=yaml - fi + ri_dirs=( ${(f)"$(_call_program ri-names "$words[1]" ${(kv)opt_args[(I)-d|--doc-dir|--((no-|)(system|site|gems|home)|standard-docs)]} --list-doc-dirs -f bs -T)"} ) - if compset -P '?*(::|\#|.)'; then + if compset -P '?*(::|:|\#|.)'; then class_dir=${IPREFIX//(::|\#|.)/\/} fi esc_name=${${(Q)PREFIX}//(#b)([^A-Za-z0-9_])/$(printf %%%x ${(qq)match[1]})} case "$IPREFIX" in - (*::) ri_wants=( 'classes:class names' 'class-methods:class methods' );; - (*\#) ri_wants=( 'instance-methods:instance methods' );; - (*.) ri_wants=( 'class-methods:class methods' 'instance-methods:instance methods' );; - (*) ri_wants=( 'classes:class names' ) + (*::) ri_wants=( 'classes:class name' 'class-methods:class method' );; + (*:) ri_wants=( 'docs:documentation file' );; + (*\#) ri_wants=( 'instance-methods:instance method' );; + (*.) ri_wants=( 'class-methods:class method' 'instance-methods:instance method' );; + (*) ri_wants=( 'classes:class name' 'gems:gem' ) esac for curtag in $ri_wants; do @@ -63,27 +52,36 @@ if [[ "$state" = ri-name ]]; then while _tags; do while _next_label "$tag" expl "$descr"; do ri_wants=() + suf=() case "$tag" in + (gems) + ri_wants=( ruby ${${(f)"$(_call_program gems gem${words[1]#ri} list -q --no-versions)"}%% *} ) + suf=( -S : ) + ;; (classes) for dir in $ri_dirs[@]; do ri_wants+=( $dir/$class_dir*(-/:t) ) done + suf=( -S '::' ) ;; (class-methods) for dir in $ri_dirs[@]; do - fnames=( $dir/$class_dir*-c.$ri_ext(-.:t) ) - ri_wants+=( ${${fnames%-c.$ri_ext}//(#b)%(??)/$(print "\\x$match[1]")} ) + fnames=( $dir/$class_dir*-c.ri(-.:t) ) + ri_wants+=( ${${fnames%-c.ri//(#b)%(??)/$(print "\\x$match[1]")} ) done ;; (instance-methods) for dir in $ri_dirs[@]; do - fnames=( $dir/$class_dir*-i.$ri_ext(-.:t) ) - ri_wants+=( ${${fnames%-i.$ri_ext}//(#b)%(??)/$(print "\\x$match[1]")} ) + fnames=( $dir/$class_dir*-i.ri(-.:t) ) + ri_wants+=( ${${fnames%-i.ri}//(#b)%(??)/$(print "\\x$match[1]")} ) done ;; + (docs) + ri_wants=( ${${(f)"$(_call_program docs $words[1] ${(kv)opt_args[(I)-d|--doc-dir|--((no-|)(system|site|gems|home)|standard-docs)]} $IPREFIX)"}:#=*} ) + ;; esac ri_names=( ${(Q)ri_wants} ) - compadd -S '' -d ri_names -a "$expl[@]" ri_wants && ret=0 + compadd $suf -d ri_names -a "$expl[@]" ri_wants && ret=0 done (( ret )) || break done diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby index 314307ebb..b6b42637d 100644 --- a/Completion/Unix/Command/_ruby +++ b/Completion/Unix/Command/_ruby @@ -44,6 +44,7 @@ opts=( \!--{en,dis}able-{gems,rubyopt,all} '--dump=[dump debug information]:information:_sequence compadd - insns insns_without_opt yydebug parsetree parsetree_with_comment' --{external,internal}'-encoding=:charset:->charsets' + '--backtrace-limit=[limit the maximum length of backtrace]:number' '!'{-y,--yydebug} '!--dump=:target:(version copyright usage yydebug syntax parsetree parsetree_with_comment insns)' '(--mjit --yjit)--jit[enable jit for the platform]' @@ -65,11 +66,10 @@ opts=( irb=( '-f[suppress read of ~/.irbrc]' - '(--noinspect)-m[bc mode (load mathn, fraction, matrix)]' $opts[(r)*-d\[*] '(--noinspect)--inspect[use inspect for output]' "(--inspect)--noinspect[don't use inspect for output]" - '(--prompt --prompt-mode --inf-ruby-mode --simple-prompt --noprompt)'{--prompt,--prompt-mode}'[switch prompt mode]:prompt mode:(default simple xmp inf-ruby)' + '(--prompt --prompt-mode --inf-ruby-mode --simple-prompt --noprompt)'{--prompt=,--prompt-mode=}'[switch prompt mode]:prompt mode:(default classic simple inf-ruby xmp null)' '(--prompt --prompt-mode --inf-ruby-mode --simple-prompt --noprompt)'{--inf-ruby-mode,--simple-prompt,--noprompt} '--tracer[display trace for each command execution]' '--back-trace-limit[set limit for backtraces]:limit [16]:'