| 1 | 
  
    ## oils_failures_allowed: 6
   | 
  | 2 | 
  
    
   | 
  | 3 | 
  
    
   | 
  | 4 | 
  
    
   | 
  | 5 | 
  
    compexport -c 'hay'
   | 
  | 6 | 
  
    
   | 
  | 7 | 
  
    ## STDOUT:
   | 
  | 8 | 
  
    "haynode "
   | 
  | 9 | 
  
    "hay "
   | 
  | 10 | 
  
    ## END
   | 
  | 11 | 
  
    
   | 
  | 12 | 
  
    
   | 
  | 13 | 
  
    
   | 
  | 14 | 
  
    # TODO: Why do we get 3 copies of echo?
   | 
  | 15 | 
  
    # compexport -c $'for x in y; do\nec'
   | 
  | 16 | 
  
    
   | 
  | 17 | 
  
    compexport -c $'for x in y; do\ncompl'
   | 
  | 18 | 
  
    
   | 
  | 19 | 
  
    
   | 
  | 20 | 
  
    ## STDOUT:
   | 
  | 21 | 
  
    "complete "
   | 
  | 22 | 
  
    ## END
   | 
  | 23 | 
  
    
   | 
  | 24 | 
  
    
   | 
  | 25 | 
  
    
   | 
  | 26 | 
  
    touch "can't touch this"
   | 
  | 27 | 
  
    
   | 
  | 28 | 
  
    compexport -c 'echo hi > c'
   | 
  | 29 | 
  
    ## STDOUT:
   | 
  | 30 | 
  
    "echo hi > can\\'t\\ touch\\ this"
   | 
  | 31 | 
  
    ## END
   | 
  | 32 | 
  
    
   | 
  | 33 | 
  
    
   | 
  | 34 | 
  
    
   | 
  | 35 | 
  
    mkdir -p "can't touch this"
   | 
  | 36 | 
  
    compexport -c 'cd ca'
   | 
  | 37 | 
  
    
   | 
  | 38 | 
  
    ## STDOUT:
   | 
  | 39 | 
  
    "cd can\\'t\\ touch\\ this/"
   | 
  | 40 | 
  
    ## END
   | 
  | 41 | 
  
    
   | 
  | 42 | 
  
    
   | 
  | 43 | 
  
    
   | 
  | 44 | 
  
    
   | 
  | 45 | 
  
    . $REPO_ROOT/testdata/completion/quoting.bash
   | 
  | 46 | 
  
    
   | 
  | 47 | 
  
    compexport -c 'pq-argv c'
   | 
  | 48 | 
  
    echo
   | 
  | 49 | 
  
    
   | 
  | 50 | 
  
    # note: excluding "can't" because there's an intentional bug
   | 
  | 51 | 
  
    compexport -c 'sq-argv ch'
   | 
  | 52 | 
  
    
   | 
  | 53 | 
  
    # Quoting doesn't match bash exactly, but it definitely works interactively!
   | 
  | 54 | 
  
    
   | 
  | 55 | 
  
    ## STDOUT:
   | 
  | 56 | 
  
    "pq-argv $'can\\'t' "
   | 
  | 57 | 
  
    "pq-argv 'ch with space' "
   | 
  | 58 | 
  
    "pq-argv checkout "
   | 
  | 59 | 
  
    "pq-argv cherry "
   | 
  | 60 | 
  
    
   | 
  | 61 | 
  
    "sq-argv 'ch with space' "
   | 
  | 62 | 
  
    "sq-argv 'checkout' "
   | 
  | 63 | 
  
    "sq-argv 'cherry' "
   | 
  | 64 | 
  
    ## END
   | 
  | 65 | 
  
    
   | 
  | 66 | 
  
    
   | 
  | 67 | 
  
    
   | 
  | 68 | 
  
    . $REPO_ROOT/testdata/completion/quoting.bash
   | 
  | 69 | 
  
    
   | 
  | 70 | 
  
    compexport -c 'q2-argv c'
   | 
  | 71 | 
  
    echo
   | 
  | 72 | 
  
    
   | 
  | 73 | 
  
    ## STDOUT:
   | 
  | 74 | 
  
    "q2-argv can\\'t "
   | 
  | 75 | 
  
    "q2-argv checkout "
   | 
  | 76 | 
  
    "q2-argv cherry "
   | 
  | 77 | 
  
    ## END
   | 
  | 78 | 
  
    
   | 
  | 79 | 
  
    
   | 
  | 80 | 
  
    
   | 
  | 81 | 
  
    touch foo bar baz
   | 
  | 82 | 
  
    
   | 
  | 83 | 
  
    compexport -c $'echo ba'
   | 
  | 84 | 
  
    
   | 
  | 85 | 
  
    
   | 
  | 86 | 
  
    ## STDOUT:
   | 
  | 87 | 
  
    
   | 
  | 88 | 
  
    TODO: Is the order reversed?  I guess this is file system order, which is
   | 
  | 89 | 
  
    nondeterministic.  YSH can sort them
   | 
  | 90 | 
  
    
   | 
  | 91 | 
  
    echo baz 
   | 
  | 92 | 
  
    echo bar 
   | 
  | 93 | 
  
    ## END
   | 
  | 94 | 
  
    
   | 
  | 95 | 
  
    
   | 
  | 96 | 
  
    
   | 
  | 97 | 
  
    __git() {
   | 
  | 98 | 
  
      COMPREPLY=(corn dill)
   | 
  | 99 | 
  
    }
   | 
  | 100 | 
  
    complete -W 'ale $(echo bean)' -F __git GIT
   | 
  | 101 | 
  
    
   | 
  | 102 | 
  
    compexport -c 'GIT '
   | 
  | 103 | 
  
    
   | 
  | 104 | 
  
    ## STDOUT:
   | 
  | 105 | 
  
    Hm they are kinda reversed, I want to fix that.  This is true even in Python
   | 
  | 106 | 
  
    though, weird.
   | 
  | 107 | 
  
    ## END
   | 
  | 108 | 
  
    
   | 
  | 109 | 
  
    
   | 
  | 110 | 
  
    
   | 
  | 111 | 
  
    
   | 
  | 112 | 
  
    touch file1 file2
   | 
  | 113 | 
  
    
   | 
  | 114 | 
  
    echo '-- nothing registered'
   | 
  | 115 | 
  
    compexport -c 'GIT '
   | 
  | 116 | 
  
    
   | 
  | 117 | 
  
    __git() {
   | 
  | 118 | 
  
      #argv.py "$@"
   | 
  | 119 | 
  
      COMPREPLY=(foo bar)
   | 
  | 120 | 
  
    }
   | 
  | 121 | 
  
    
   | 
  | 122 | 
  
    complete -F __git GIT
   | 
  | 123 | 
  
    
   | 
  | 124 | 
  
    echo '-- func'
   | 
  | 125 | 
  
    compexport -c 'GIT '
   | 
  | 126 | 
  
    
   | 
  | 127 | 
  
    complete -F __git -o default GIT
   | 
  | 128 | 
  
    echo '-- func default'
   | 
  | 129 | 
  
    compexport -c 'GIT '
   | 
  | 130 | 
  
    
   | 
  | 131 | 
  
    __git() {
   | 
  | 132 | 
  
      # don't show anything
   | 
  | 133 | 
  
      true
   | 
  | 134 | 
  
    }
   | 
  | 135 | 
  
    
   | 
  | 136 | 
  
    # have to RE-REGISTER after defining function!  Hm
   | 
  | 137 | 
  
    complete -F __git -o default GIT
   | 
  | 138 | 
  
    
   | 
  | 139 | 
  
    echo '-- empty func default'
   | 
  | 140 | 
  
    compexport -c 'GIT '
   | 
  | 141 | 
  
    
   | 
  | 142 | 
  
    # Is the order reversed?
   | 
  | 143 | 
  
    # Does GNU readline always sort them?
   | 
  | 144 | 
  
    
   | 
  | 145 | 
  
    ## STDOUT:
   | 
  | 146 | 
  
    TODO
   | 
  | 147 | 
  
    git
   | 
  | 148 | 
  
    ## END
   | 
  | 149 | 
  
    
   | 
  | 150 | 
  
    # TODO:
   | 
  | 151 | 
  
    # --begin --end  
   | 
  | 152 | 
  
    # --table ?  For mulitiple completions
   | 
  | 153 | 
  
    # compatible with -C ?
   | 
  | 154 | 
  
    # --trace - show debug_f tracing on stderr?  Would be very nice!
   | 
  | 155 | 
  
    
   | 
  | 156 | 
  
    
   | 
  | 157 | 
  
    
   | 
  | 158 | 
  
    # Hack for lenny: version detection for 2.17.1 on Ubuntu 18.02
   | 
  | 159 | 
  
    if ! git --list-cmds=list-complete >/dev/null; then
   | 
  | 160 | 
  
      cat <<'EOF'
   | 
  | 161 | 
  
    status=0
   | 
  | 162 | 
  
    "git cherry "
   | 
  | 163 | 
  
    "git cherry-pick "
   | 
  | 164 | 
  
    "git checkout "
   | 
  | 165 | 
  
    EOF
   | 
  | 166 | 
  
      return
   | 
  | 167 | 
  
    fi
   | 
  | 168 | 
  
    
   | 
  | 169 | 
  
    . $REPO_ROOT/testdata/completion/git-completion.bash
   | 
  | 170 | 
  
    echo status=$?
   | 
  | 171 | 
  
    
   | 
  | 172 | 
  
    #complete
   | 
  | 173 | 
  
    
   | 
  | 174 | 
  
    # Bug: it has an extra \ on it
   | 
  | 175 | 
  
    compexport -c 'git ch'
   | 
  | 176 | 
  
    
   | 
  | 177 | 
  
    ## status: 0
   | 
  | 178 | 
  
    ## STDOUT:
   | 
  | 179 | 
  
    status=0
   | 
  | 180 | 
  
    "git cherry "
   | 
  | 181 | 
  
    "git cherry-pick "
   | 
  | 182 | 
  
    "git checkout "
   | 
  | 183 | 
  
    ## END
   | 
  | 184 | 
  
    
   | 
  | 185 | 
  
    
   | 
  | 186 | 
  
    
   | 
  | 187 | 
  
    touch hello
   | 
  | 188 | 
  
    touch $'hi\xffthere'
   | 
  | 189 | 
  
    
   | 
  | 190 | 
  
    compexport -c 'echo h'
   | 
  | 191 | 
  
    ## STDOUT:
   | 
  | 192 | 
  
    TODO
   | 
  | 193 | 
  
    ## END
   | 
  | 194 | 
  
    
   | 
  | 195 | 
  
    
   | 
  | 196 | 
  
    
   | 
  | 197 | 
  
    touch foo fooz
   | 
  | 198 | 
  
    
   | 
  | 199 | 
  
    compexport -c $'echo "bad \xff byte" f'
   | 
  | 200 | 
  
    
   | 
  | 201 | 
  
    ## STDOUT:
   | 
  | 202 | 
  
    TODO
   | 
  | 203 | 
  
    ## END
   | 
  | 204 | 
  
    
   |