# autoscan(1) completion -*- shell-script -*- proc _autoscan { var cur = '', prev = '', words = '', cword = '', split = '' _init_completion -s || return matchstr $prev { --help|-h|--version|-V { return 0 } --prepend-include|-B|--include|-I { _filedir -d return 0 } } $split && return 0 if [[ "$cur" == -* ]] { global COMPREPLY := '( '$( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 } if [[ $1 == autoupdate ]] { _filedir '@(ac|in)' } else { _filedir -d } } && complete -F _autoscan autoscan autoupdate # ex: ts=4 sw=4 et filetype=sh (CommandList children: [ (AndOr children: [ (FuncDef name: _autoscan 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]) (assign_pair lhs:(LhsName name:split) op:Equal spids:[21]) ] spids: [11] ) (AndOr children: [ (C {(_init_completion)} {(-s)}) (ControlFlow token:) ] op_id: Op_DPipe ) (Case to_match: {(DQ ($ VSub_Name "$prev"))} arms: [ (case_arm pat_list: [{(--help)} {(-h)} {(--version)} {(-V)}] action: [(ControlFlow token: arg_word:{(0)})] spids: [43 50 58 -1] ) (case_arm pat_list: [{(--prepend-include)} {(-B)} {(--include)} {(-I)}] action: [ (C {(_filedir)} {(-d)}) (ControlFlow token: arg_word: {(0)} ) ] spids: [61 68 81 -1] ) ] spids: [34 40 84] ) (AndOr children: [ (C {($ VSub_Name "$split")}) (ControlFlow token: arg_word:{(0)}) ] op_id: Op_DAmp ) (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 <"$( _parse_help \"$1\" )">)} {(--)} {(DQ ($ VSub_Name "$cur"))} ) ] ) left_token: spids: [120 136] ) } ] ) } spids: [117] ) ] spids: [117] ) (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$COMPREPLY")} right: {(Lit_Other "*") (BoolBinary_GlobEqual "=")} ) ) (C {(compopt)} {(-o)} {(nospace)}) ] op_id: Op_DAmp ) (ControlFlow token: arg_word: {(0)} ) ] spids: [-1 114] ) ] spids: [-1 166] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Number "$1")} right: {(autoupdate)} ) ) terminator: ) ] action: [(C {(_filedir)} {(SQ <"@(ac|in)">)})] spids: [-1 184] ) ] else_action: [(C {(_filedir)} {(-d)})] spids: [194 202] ) ] spids: [8] ) spids: [4 7] ) (C {(complete)} {(-F)} {(_autoscan)} {(autoscan)} {(autoupdate)}) ] op_id: Op_DAmp ) ] )