zsh-workers
 help / color / mirror / code / Atom feed
2a18ecc8dab2440e1df693993191fb8be55beb33 blob 2503 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
 
#compdef flowadm
# Synced with the Nevada build 171 man page

_flowadm() {

local -a subcmds tr props
local expl

_flowadm_flow(){
	compadd "$@" - $(flowadm show-flow -p -o flow)
}

_flowadm_flow_int(){
	compadd "$@" - $(flowadm show-flow -p -o flow)
	compadd "$@" - $(dladm show-phys -p -o device)
}

subcmds=(
	"show-flow"
	"add-flow"
	"remove-flow"
	"set-flowprop"
	"reset-flowprop"
	"show-flowprop"
)
	
tr=(
	"tcp"
	"udp"
	"sctp"
	"icmp"
	"icmpv6"
)

props=(
	"maxbw"
)

if [[ $service == "flowadm" ]]; then
	_arguments -C -A "-*" \
		'*::command:->subcmd' && return 0
	
	if (( CURRENT == 1 )); then
		_wanted commands expl "flowadm subcommand" compadd -a subcmds
		return
	fi
	service="$words[1]"
	curcontext="${curcontext%:*}=$service:"
fi
case $service in

	("show-flow")
	_arguments -A "-*" \
		'-o[specify field to display]:field:(flow link ipaddr proto port dsfield)' \
		'-p[parsable output]' \
		'-P[persistent flow property information]' \
		- set1 \
		'-l[display information for link]:link or flow:_net_interfaces' \
		- set2 \
		':flow:_flowadm_flow' \
	;;

	("add-flow")
	_arguments -A "-*" \
		'-t[temporary changes - do not persist across reboots]' \
		'-R[alternate root dir]:alternate root:_files' \
		'-l[specify link to which flow will be added]:link:_net_interfaces' \
		'-a[specify attribute]:attribute:(local_ip= remote_ip= transport=$tr local_port= dsfield=)' \
		'-p[set property value]:property:(maxbw=)' \
	;;

	("remove-flow")
	_arguments -A "-*" \
		'-t[temporary changes - do not persist across reboots]' \
		'-R[alternate root dir]:alternate root:_files' \
		- set1 \
		'-l[specify link from which flow will be deleted]:link:_net_interfaces' \
		- set2 \
		':flow:_flowadm_flow' \
	;;

	("set-flowprop")
	_arguments -A "-*" \
		'-t[temporary changes - do not persist across reboots]' \
		'-R[alternate root dir]:alternate root:_files' \
		'-p[set property value]:property:(maxbw=)' \
		':flow:_flowadm_flow' \
	;;

	("reset-flowprop")
	_arguments -A "-*" \
		'-t[temporary changes - do not persist across reboots]' \
		'-R[alternate root dir]:alternate root:_files' \
		'-p[set property value]:property:(maxbw=)' \
		':flow:_flowadm_flow' \
	;;

	("show-flowprop")
	_arguments -A "-*" \
		'-c[parsable output (requires -o)]' \
		'-l[specify link whose properties will be shown]:link:_net_interfaces' \
		'-P[persistent flow property information]' \
		'-p[property to show]:property:_values -s , "property" $props' \
		':flow:_flowadm_flow' \
	;;

esac
}

_flowadm "$@"
debug log:

solving 2a18ecc ...
found 2a18ecc in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).