Merge pull request #1088 from Mumumu4/fix-nft-type-in-name

Fix nftables completion: when object name contains its type name
This commit is contained in:
Shohei YOSHIDA 2024-06-26 11:32:26 +09:00 committed by GitHub
commit 7313f8360b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -472,7 +472,7 @@ _nft_object(){
#$3:object type (chain/set/map/flowtable/ct helper/counter/quota/meter)
#$4:include 'handle'?
local objects=( ${(f)"$(_call_program -p objects nft -a list table $1 $2 2>/dev/null\
| grep ""\\s\*$3"" | sed 's/\s*'"$3"' // ;s/ { # \(.*\)/:(\1)/' )"} )
| grep ""\^\\s\*$3"" | sed 's/\s*'"$3"' // ;s/ { # \(.*\)/:(\1)/' )"} )
if $4 ;then
objects+=( "handle:address $3 by handle")
fi
@ -485,7 +485,7 @@ _nft_object_handle(){
#$2:table
#$3:object type (chain/set/ct helper/counter/quota)
local handles=( ${(f)"$(_call_program -p handles nft -a list table $1 $2 2>/dev/null\
| grep ""\\s\*$3"" | sed 's/\s*'"$3"' // ;s/ { # handle// ;s/\(\S*\) \(\S*\)/\2:\1/' )"} )
| grep ""\^\\s\*$3"" | sed 's/\s*'"$3"' // ;s/ { # handle// ;s/\(\S*\) \(\S*\)/\2:\1/' )"} )
_describe -t handles "$3-handle" handles
}