# iwconfig completion -*- shell-script -*- proc _iwconfig { var cur = '', prev = '', words = '', cword = '' _init_completion || return matchstr $prev { mode { global COMPREPLY := '( '$( compgen -W 'managed ad-hoc master repeater secondary monitor' -- "$cur" ) ) return 0 } essid { global COMPREPLY := '( '$( compgen -W 'on off any' -- "$cur" ) ) if [[ -n ${COMP_IWLIST_SCAN:-} ]] { global COMPREPLY := '( '$( compgen -W \ "$( iwlist ${words[1]} scan | \ awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) ) } return 0 } nwid { global COMPREPLY := '( '$( compgen -W 'on off' -- "$cur" ) ) return 0 } channel { global COMPREPLY := '( '$( compgen -W "$( iwlist ${words[1]} channel | \ awk '/^[ \t]*Channel/ {print $2}' )" -- "$cur" ) ) return 0 } freq { global COMPREPLY := '( '$( compgen -W "$( iwlist ${words[1]} channel | \ awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur" ) ) return 0 } ap { global COMPREPLY := '( '$( compgen -W 'on off any' -- "$cur" ) ) if [[ -n ${COMP_IWLIST_SCAN:-} ]] { global COMPREPLY := '( '$( compgen -W \ "$( iwlist ${words[1]} scan | \ awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) ) } return 0 } rate { global COMPREPLY := '( '$( compgen -W 'auto fixed' -- "$cur" ) ) global COMPREPLY := '( '$( compgen -W \ "$( iwlist ${words[1]} rate | \ awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) ) return 0 } rts|frag { global COMPREPLY := '( '$( compgen -W 'auto fixed off' -- "$cur" ) ) return 0 } key|enc { global COMPREPLY := '( '$( compgen -W 'off on open restricted' -- "$cur" ) ) return 0 } power { global COMPREPLY := '( '$( compgen -W 'period timeout off on' -- "$cur" ) ) return 0 } txpower { global COMPREPLY := '( '$( compgen -W 'off on auto' -- "$cur" ) ) return 0 } retry { global COMPREPLY := '( '$( compgen -W 'limit lifetime' -- "$cur" ) ) return 0 } } if [[ $cword -eq 1 ]] { if [[ "$cur" == -* ]] { global COMPREPLY := '( '$( compgen -W '--help --version' -- "$cur" ) ) } else { _available_interfaces -w } } else { global COMPREPLY := '( '$( compgen -W 'essid nwid mode freq channel sens mode ap nick rate rts frag enc key power txpower commit' -- "$cur" ) ) } } && complete -F _iwconfig iwconfig # ex: ts=4 sw=4 et filetype=sh (CommandList children: [ (AndOr children: [ (FuncDef name: _iwconfig body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs:(LhsName name:cur) op:Equal spids:[13]) (assign_pair lhs:(LhsName name:prev) op:Equal spids:[15]) (assign_pair lhs:(LhsName name:words) op:Equal spids:[17]) (assign_pair lhs:(LhsName name:cword) op:Equal spids:[19]) ] spids: [11] ) (AndOr children: [(C {(_init_completion)}) (ControlFlow token:)] op_id: Op_DPipe ) (Case to_match: {($ VSub_Name "$prev")} arms: [ (case_arm pat_list: [{(mode)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} { (SQ < "managed ad-hoc master repeater secondary\n" > <" monitor"> ) } {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [44 61] ) } ] ) } spids: [41] ) ] spids: [41] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [37 38 71 -1] ) (case_arm pat_list: [{(essid)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} {(SQ <"on off any">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [81 97] ) } ] ) } spids: [78] ) ] spids: [78] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_n child: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{}) spids: [108 111] ) } ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: PlusEqual rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(iwlist)} { (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w: { ( Lit_Digits 1 ) } ) ) spids: [135 140] ) } {(scan)} ) (C {(awk)} {(-F) (SQ <"\\\"">)} {(SQ <"/ESSID/ {print $2}">)} ) ] negated: False ) ] ) left_token: spids: [131 159] ) ) } {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [122 168] ) } ] ) } spids: [119] ) ] spids: [119] ) ] spids: [-1 116] ) ] spids: [-1 173] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [74 75 181 -1] ) (case_arm pat_list: [{(nwid)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} {(SQ <"on off">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [191 207] ) } ] ) } spids: [188] ) ] spids: [188] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [184 185 217 -1] ) (case_arm pat_list: [{(channel)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(iwlist)} { (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w: {(Lit_Digits 1)} ) ) spids: [238 243] ) } {(channel)} ) (C {(awk)} { (SQ < "/^[ \\t]*Channel/ {print $2}" > ) } ) ] negated: False ) ] ) left_token: spids: [234 257] ) ) } {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [227 266] ) } ] ) } spids: [224] ) ] spids: [224] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [220 221 276 -1] ) (case_arm pat_list: [{(freq)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(iwlist)} { (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w: {(Lit_Digits 1)} ) ) spids: [298 303] ) } {(channel)} ) (C {(awk)} { (SQ < "/^[ \\t]*Channel/ {print $4\"G\"}" > ) } ) ] negated: False ) ] ) left_token: spids: [294 316] ) ) } {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [287 325] ) } ] ) } spids: [284] ) ] spids: [284] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [280 281 335 -1] ) (case_arm pat_list: [{(ap)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} {(SQ <"on off any">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [345 361] ) } ] ) } spids: [342] ) ] spids: [342] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_n child: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{}) spids: [372 375] ) } ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: PlusEqual rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(iwlist)} { (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w: { ( Lit_Digits 1 ) } ) ) spids: [399 404] ) } {(scan)} ) (C {(awk)} {(-F)} {(SQ <": ">)} { (SQ < "/Address/ {print $2}" > ) } ) ] negated: False ) ] ) left_token: spids: [395 424] ) ) } {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [386 433] ) } ] ) } spids: [383] ) ] spids: [383] ) ] spids: [-1 380] ) ] spids: [-1 438] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [338 339 446 -1] ) (case_arm pat_list: [{(rate)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} {(SQ <"auto fixed">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [456 472] ) } ] ) } spids: [453] ) ] spids: [453] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: PlusEqual rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(iwlist)} { (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w: {(Lit_Digits 1)} ) ) spids: [493 498] ) } {(rate)} ) (C {(awk)} { (SQ < "/^[ \\t]*[0-9]/ {print $1\"M\"}" > ) } ) ] negated: False ) ] ) left_token: spids: [489 512] ) ) } {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [480 521] ) } ] ) } spids: [477] ) ] spids: [477] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [449 450 531 -1] ) (case_arm pat_list: [{(rts)} {(frag)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} {(SQ <"auto fixed off">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [543 559] ) } ] ) } spids: [540] ) ] spids: [540] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [534 537 569 -1] ) (case_arm pat_list: [{(key)} {(enc)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} {(SQ <"off on open restricted">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [581 597] ) } ] ) } spids: [578] ) ] spids: [578] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [572 575 607 -1] ) (case_arm pat_list: [{(power)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} {(SQ <"period timeout off on">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [617 633] ) } ] ) } spids: [614] ) ] spids: [614] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [610 611 643 -1] ) (case_arm pat_list: [{(txpower)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} {(SQ <"off on auto">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [653 669] ) } ] ) } spids: [650] ) ] spids: [650] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [646 647 679 -1] ) (case_arm pat_list: [{(retry)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} {(SQ <"limit lifetime">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [689 705] ) } ] ) } spids: [686] ) ] spids: [686] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [682 683 715 -1] ) ] spids: [30 34 718] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_eq left: {($ VSub_Name "$cword")} right: {(1)} ) ) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$cur"))} right: {(-) (Lit_Other "*")} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} {(SQ <"--help --version">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [760 776] ) } ] ) } spids: [757] ) ] spids: [757] ) ] spids: [-1 754] ) ] else_action: [(C {(_available_interfaces)} {(-w)})] spids: [781 789] ) ] spids: [-1 735] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(compgen)} {(-W)} { (SQ <"essid nwid mode freq channel sens mode ap\n"> < " nick rate rts frag enc key power txpower commit" > ) } {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [798 815] ) } ] ) } spids: [795] ) ] spids: [795] ) ] spids: [792 820] ) ] spids: [8] ) spids: [4 7] ) (C {(complete)} {(-F)} {(_iwconfig)} {(iwconfig)}) ] op_id: Op_DAmp ) ] )