Compare commits
No commits in common. "d8eb38dd1668f7a9a30c20a9160f908ed6103147" and "e1465ebe678daa6867723ce1cfbb0d60cf91bce5" have entirely different histories.
d8eb38dd16
...
e1465ebe67
2 changed files with 0 additions and 76 deletions
|
@ -1,36 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Function for autocompletion
|
|
||||||
_igmpgen_completion() {
|
|
||||||
local cur prev opts igmp_types
|
|
||||||
COMPREPLY=() # Array variable storing the completions.
|
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}" # Current word being completed.
|
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}" # Previous word.
|
|
||||||
|
|
||||||
# Options for igmpgen
|
|
||||||
opts="-i -t -g -s -d -n"
|
|
||||||
|
|
||||||
# Available IGMP packet types
|
|
||||||
igmp_types="1.query 1.report 1.dvmrp 2.query 2.report 2.leave 3.report"
|
|
||||||
|
|
||||||
case "${prev}" in
|
|
||||||
-t)
|
|
||||||
COMPREPLY=( $(compgen -W "${igmp_types}" -- ${cur}) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# If the previous word is an option requiring an argument, don't complete with options
|
|
||||||
case "${prev}" in
|
|
||||||
-i | -g | -s | -d | -n)
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Default completion: suggest igmpgen options
|
|
||||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
||||||
}
|
|
||||||
|
|
||||||
# Attach the completion function to igmpgen command
|
|
||||||
complete -F _igmpgen_completion igmpgen
|
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
#compdef igmpgen
|
|
||||||
|
|
||||||
# Function to handle autocompletion for igmpgen
|
|
||||||
_igmpgen() {
|
|
||||||
local -a options
|
|
||||||
local -a igmp_types
|
|
||||||
|
|
||||||
# Options for igmpgen
|
|
||||||
options=(
|
|
||||||
'-i[Specify the network interface (e.g., eth0)]'
|
|
||||||
'-t[Specify the IGMP packet type and version (e.g., 1.query)]'
|
|
||||||
'-g[Specify the IGMP group (e.g., 224.0.0.1)]'
|
|
||||||
'-s[Specify the source IP and port (e.g., 192.168.1.1:1234)]'
|
|
||||||
'-d[Specify the destination IP and port (e.g., 224.0.0.2:5678)]'
|
|
||||||
'-n[Specify delay between packets in seconds]'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Available IGMP packet types
|
|
||||||
igmp_types=(
|
|
||||||
'1.query'
|
|
||||||
'1.report'
|
|
||||||
'1.dvmrp'
|
|
||||||
'2.query'
|
|
||||||
'2.report'
|
|
||||||
'2.leave'
|
|
||||||
'3.report'
|
|
||||||
)
|
|
||||||
|
|
||||||
_arguments -s $options && return
|
|
||||||
|
|
||||||
case $words[1] in
|
|
||||||
-t)
|
|
||||||
_describe -t igmp-types 'IGMP packet type' igmp_types
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
_igmpgen
|
|
||||||
|
|
Loading…
Reference in a new issue