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,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31643 invoked from network); 16 Mar 2022 03:20:57 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 16 Mar 2022 03:20:57 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1647400857; b=DJS8vD+98boxzpzEagP7PkI64IwRNuYfdalLEKFedhkzkF/qvtTNBPaE9VbPsZ870yZA8zYOFy cCUOVVV6lDEVF2mDRr9faDVQGewWW2WXFXdrgMFsC6FmWmBpNNvqktR5WUZoqMoV/O256J4ce/ 3OLgs9IZGEWRmDfR/2YV3gGTlm7tsNM6FTYO6T5jBj5DIHSVx7OYr320FPEY6PkIv587SEjrgb Wg50wUvWhscdczComH/BhgxnAv2YuCDXdnh+rc8lGKfUO6HwSZr8L49W3isX17Xs471wTyvqVR +dU0XJHZTtb+9JDdY66zLc4hlIS50xFlGtQP0gQ/XVFPCQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oi1-f170.google.com) smtp.remote-ip=209.85.167.170; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1647400857; bh=6P42eoamjQCf322e0jSmVEy1Kofv8nUIBMeq3XWjnw0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:MIME-Version:Message-ID:Subject:To:From:Date: DKIM-Signature:DKIM-Signature; b=HFxfQ7/7zuht7f3sb3TRd8yFlaAOAsv9kcXct8Acolz4bJBNkGhbQYHzKc1ENPHlX9bh6tFUz2 cxnlU8zjW9+Zzi13hAJ+KFlR1odrAAET1QTrr6uU9iVPIRKTQgr+ggPWU1hMgC2MJN+ZixHGPe EiH3g2JcrdzibZYoo3KcATJg+ukonpAKx81Ecn67GDFSbyDSBzV954qPFJA0ZZWPPPzrIuiBd5 0eLrJr2YVvPYGX2UbHs6cFWpE/Mdp4mqTSbk7UGtjsMOUArkRe02hHkIDPsSUErn81RIkCLfzH /m1+y9ouJtxE/AasNufWKoJvAdQ16ZfxjmvfwYNbUNDYcA==; 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:Content-Type:MIME-Version:Message-ID: Subject:To:From:Date:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=x4igzRuslG9iWKjJI99uYdUbnMGpPOzduBCF7hiB65U=; b=rTQppjz98C2ecyV9ffqznLY8SB ytV8rSHIwyb0tLcAs4r5EBUpQsrtia9syh011JzfMaGflARoyNgPr69KGp6qNBhovHJYEomXytpgj dRT2aOs1Qr4INLzUDjTLPLRtBzRi2hXCkdKL2y50uAdL/xMWWJ69MoHO1ZMTHNr9Xd2ThWHhWjcTR mGsqXRM4K2e26X1MxLMIoLU/8Zb8LnGjDZUfkV/22rUrbYozKFhBmdIfezBoM2z4vwJ9s+ADOacBx bUR4uGGYVHEAA/7NoOOH4jmMEXYK2u3mYhz1X6MLzPf7JBE1AmL73L6z8A8dbBXmgj0h9JnuRsjnE dlqh7VBg==; Received: from authenticated user by zero.zsh.org with local id 1nUKDY-000HDq-S3; Wed, 16 Mar 2022 03:20:56 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oi1-f170.google.com) smtp.remote-ip=209.85.167.170; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-oi1-f170.google.com ([209.85.167.170]:35443) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1nUKDI-000GoX-P3; Wed, 16 Mar 2022 03:20:41 +0000 Received: by mail-oi1-f170.google.com with SMTP id w2so1347799oie.2 for ; Tue, 15 Mar 2022 20:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition; bh=x4igzRuslG9iWKjJI99uYdUbnMGpPOzduBCF7hiB65U=; b=FTLPFWyut3Qa04kE39LWc6y8FtddvhFm3eSUNR7AaCh4RraUwAo9/JEOR83n4Oh/QF +9osVVmwU9czo0OOg6wxGg/FvFlsCXZcNx6vjzZajCFgjWxmBX1ZtiR8QIJhngf16Fu0 2/F1+eoWYhGnGsfJT+Ufo3LO45Pql+2pwHIqH1W5K3SKGC039bzpYb539L7edDfgne9r ehlRz2LM1X1UeEpL+sJqXlrmt6EOHtalWxvv2k8drjblgdiGY0Zh5rRcH6jWH/Iy6ksq 58mvceD9wSOr6KfVmAczPGrlQwSyl3XZCl8SKdwvyOG1RAHl0fqzgXth74YXHiR+LhoP 1f0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :mime-version:content-disposition; bh=x4igzRuslG9iWKjJI99uYdUbnMGpPOzduBCF7hiB65U=; b=5chj7p++HaVh5u3XornAOA8cpzIayYdMbfxTrtPchw3TejHaedmD8D0v7fTREop7w9 MNe3J+66v9DHW/5cC/WZE2J8j++zMJJY+GtaYAEcSIR9kjx2524ImlLGeZ/Y514VeyLR mAeG07yWZ6x4/hu5PMftOh0m58Jn1fLbf0FFJyn1ybCoLQLxt3wu4f57xuyNWTP6O1Uy vlUkmSMIsFyESjoQMmVxalOt2UL036MfHYS0WEDupz/s9BZ1BUeWCnXupgQEpcJHRLWh FwX8+ndjc37XE+6wuihrtuM3iy4uFUeJkd4mWFakomHAsi9s3p8aSRJTKae6EZsYUp0J La/A== X-Gm-Message-State: AOAM531U2WDzXkuBkhY7qoFR6BBh3VuQnZ9RKqMowM30aeLYWz/HQrN2 HnwBeJUyPY03gIxORWRxD6w2s+l4eXM= X-Google-Smtp-Source: ABdhPJwEzE5ZkuU59c/YgtlTZyYVhuzSFvNVtX/502rhRQiiyu5NayBUu4CIDaDohH5tZsqwsryVNw== X-Received: by 2002:a05:6808:190e:b0:2da:226f:5ab with SMTP id bf14-20020a056808190e00b002da226f05abmr3170093oib.13.1647400839442; Tue, 15 Mar 2022 20:20:39 -0700 (PDT) Received: from CptOrmolo.darkstar (cpe-76-184-110-212.tx.res.rr.com. [76.184.110.212]) by smtp.gmail.com with ESMTPSA id z192-20020a4a49c9000000b003213bf4bf0csm401549ooa.31.2022.03.15.20.20.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Mar 2022 20:20:39 -0700 (PDT) Date: Tue, 15 Mar 2022 22:20:36 -0500 From: Matthew Martin To: zsh-workers@zsh.org Subject: PATCH: Add _routing_domains and _routing_tables types Message-ID: Mail-Followup-To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Seq: 49852 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: Note for _routing_tables, while somewhat unusual, it is possible for an rdomain to have multiple rtables in which case the label in netstat output will be made plural and the rtables separated by spaces. diff --git a/Completion/BSD/Command/_pfctl b/Completion/BSD/Command/_pfctl index 23898882f..812e52bdb 100644 --- a/Completion/BSD/Command/_pfctl +++ b/Completion/BSD/Command/_pfctl @@ -66,7 +66,7 @@ case $OSTYPE in "-N[don't perform domain name resolution]" '-P[display ports using service names]' '-S+[store pf state table in the specified file]:file:_files' - '-V+[select routing domain to be used to kill states]:routing domain' + '-V+[select routing domain to be used to kill states]:routing domain:_routing_domains' ) ;; (free|net)bsd*) diff --git a/Completion/BSD/Type/_routing_domains b/Completion/BSD/Type/_routing_domains new file mode 100644 index 000000000..4bb9f78b0 --- /dev/null +++ b/Completion/BSD/Type/_routing_domains @@ -0,0 +1,6 @@ +#autoload + +local expl + +_description routing-domains expl 'routing domain' +compadd "$@" "$expl[@]" - ${${(M)${(f)"$(_call_program routing-domains netstat -R)"}:#Rdomain *}#Rdomain } diff --git a/Completion/BSD/Type/_routing_tables b/Completion/BSD/Type/_routing_tables new file mode 100644 index 000000000..3ba1931fe --- /dev/null +++ b/Completion/BSD/Type/_routing_tables @@ -0,0 +1,6 @@ +#autoload + +local expl + +_description routing-tables expl 'routing table' +compadd "$@" "$expl[@]" - ${(s: :)${${(M)${(f)"$(_call_program routing-tables netstat -R)"}:# Routing tables#: *}#*: }} diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp index 389f1099b..7727de28c 100644 --- a/Completion/Unix/Command/_arp +++ b/Completion/Unix/Command/_arp @@ -61,7 +61,7 @@ case $OSTYPE in openbsd*) args+=( '(-a -d -W)-F[overwrite existing entries]' - '(-W)-V+[select the routing domain]:routing domain' + '(-W)-V+[select the routing domain]:routing domain:_routing_domains' ) cmds+=( '(- 1)-W[send the wake on LAN frame]' diff --git a/Completion/Unix/Command/_netstat b/Completion/Unix/Command/_netstat index aa6c92fde..67133dc6c 100644 --- a/Completion/Unix/Command/_netstat +++ b/Completion/Unix/Command/_netstat @@ -270,7 +270,7 @@ case $OSTYPE in sel_rdomains=( '-R[show all rdomains with associated interfaces and routing tables]' ) sel_wireless=( '-W+[display per-interface IEEE 802.11 wireless statistics]:interface' ) flist+=( local mpls ) - tblopt='-T+[select an alternate routing table to query]:routing table' + tblopt='-T+[select an alternate routing table to query]:routing table:_routing_tables' sockets+=( -l$lopt $tblopt '-B[show buffer sizes for TCP sockets]' ) routing+=( $Mopts $tblopt '-A[show the internal addresses of the routing table]' diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index afd2fe54b..9c3ddf039 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -5,7 +5,6 @@ # (which changed the behaviour of -f and added -a) # - We don't really need to keep pgopts and pkopts separate, but it seems like # it should make things a bit easier to follow -# - @todo We could complete routing tables given to -T local curcontext="$curcontext" state line ret=1 expl pgopts pkopts no typeset -A opt_args @@ -39,7 +38,7 @@ arguments=( '(-s --session)'{-s+,--session=}'[match only on specified process session IDs]: :->sid' # _signals is OK here - we do it differently below '(ss)--signal=[specify signal to send to process]: :_signals -s' - '-T+[match only on specified routing table]:routing table' + '-T+[match only on specified routing table]:routing table:_routing_tables' '(-t --terminal)'{-t+,--terminal=}'[match only on specified controlling terminals]: :_sequence _ttys -do' '(-U --uid)'{-U+,--uid=}'[match only on specified real user IDs]: :_sequence _users' '(-u --euid)'{-u+,--euid=}'[match only on specified effective user IDs]: :_sequence _users' diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping index b371e808f..d36a0f3a9 100644 --- a/Completion/Unix/Command/_ping +++ b/Completion/Unix/Command/_ping @@ -191,7 +191,7 @@ case ${variant}:${${service#ping}:-4} in '-e[audible bell for each packet]' '-g[provide a visual display of packets received and lost]' '-T+[change TOS value]:TOS value:(critical inetcontrol lowdelay netcontrol throughput reliability ef af cs)' - '-V+[specify routing table to be used]:routing table' + '-V+[specify routing table to be used]:routing table:_routing_tables' ) ;; iputils:*) diff --git a/Completion/Unix/Command/_route b/Completion/Unix/Command/_route index 06cca8d99..95df6d936 100644 --- a/Completion/Unix/Command/_route +++ b/Completion/Unix/Command/_route @@ -135,7 +135,7 @@ case $OSTYPE in openbsd*) subcmds+=( exec 'execute a command with alternate routing table' ) args+=( - '-T+[select specified alternate routing table]:table id' + '-T+[select specified alternate routing table]:routing table:_routing_tables' ) modifiers+=( -sa diff --git a/Completion/Unix/Command/_top b/Completion/Unix/Command/_top index af3deb6c7..692df790d 100644 --- a/Completion/Unix/Command/_top +++ b/Completion/Unix/Command/_top @@ -96,7 +96,7 @@ case $OSTYPE in '-C[show command arguments as well as process name]' '-g+[filter processes by the specified string]:string' '-o+[sort process display by the specified field]:field:->sortkey' - '-T+[filter processes by the specified routing table]:routing table' + '-T+[filter processes by the specified routing table]:routing table:_routing_tables' '-U+[filter processes by the specified user]: :_users -M "L\:|-="' );; darwin*)