You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bs...@apache.org on 2026/09/03 10:15:43 UTC

(cloudstack-cloudmonkey) branch main updated: Use ergochat/readline (#199)

This is an automated email from the ASF dual-hosted git repository.

borisstoyanov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git


The following commit(s) were added to refs/heads/main by this push:
     new fad5ae6  Use ergochat/readline  (#199)
fad5ae6 is described below

commit fad5ae697de765bcf5324433cf0a99ae36adad87
Author: Vishesh <87...@users.noreply.github.com>
AuthorDate: Thu Sep 3 15:45:37 2026 +0530

    Use ergochat/readline  (#199)
    
    * Migrate to ergochat readline
    
    * Fix ci gha
    
    * Fixup
    
    * readline: bound the DSR cursor query, record vendor patches
---
 .rat-excludes                                      |    3 +-
 Makefile                                           |   16 +
 cli/prompt.go                                      |    2 +-
 go.mod                                             |    5 +-
 go.sum                                             |   15 +-
 patches/README.md                                  |   91 ++
 patches/ergochat-readline-v0.1.3.patch             |  175 +++
 snap/snapcraft.yaml                                |    5 +-
 vendor/github.com/chzyer/readline/.travis.yml      |    8 -
 vendor/github.com/chzyer/readline/CHANGELOG.md     |   58 -
 vendor/github.com/chzyer/readline/README.md        |  114 --
 vendor/github.com/chzyer/readline/ansi_windows.go  |  249 ----
 vendor/github.com/chzyer/readline/complete.go      |  314 -----
 .../github.com/chzyer/readline/complete_helper.go  |  165 ---
 .../github.com/chzyer/readline/complete_segment.go |   82 --
 vendor/github.com/chzyer/readline/operation.go     |  537 --------
 vendor/github.com/chzyer/readline/password.go      |   33 -
 .../chzyer/readline/rawreader_windows.go           |  125 --
 vendor/github.com/chzyer/readline/readline.go      |  338 -----
 vendor/github.com/chzyer/readline/remote.go        |  475 -------
 vendor/github.com/chzyer/readline/runebuf.go       |  629 ---------
 vendor/github.com/chzyer/readline/std.go           |  197 ---
 vendor/github.com/chzyer/readline/std_windows.go   |    9 -
 vendor/github.com/chzyer/readline/term.go          |  123 --
 vendor/github.com/chzyer/readline/term_bsd.go      |   29 -
 vendor/github.com/chzyer/readline/term_linux.go    |   33 -
 .../github.com/chzyer/readline/term_nosyscall6.go  |   32 -
 vendor/github.com/chzyer/readline/term_unix.go     |   24 -
 vendor/github.com/chzyer/readline/term_windows.go  |  171 ---
 vendor/github.com/chzyer/readline/terminal.go      |  254 ----
 vendor/github.com/chzyer/readline/utils.go         |  311 -----
 vendor/github.com/chzyer/readline/utils_unix.go    |   83 --
 vendor/github.com/chzyer/readline/utils_windows.go |   41 -
 vendor/github.com/chzyer/readline/windows_api.go   |  152 ---
 .../github.com/ergochat/readline/.check-gofmt.sh   |   14 +
 .../{chzyer => ergochat}/readline/.gitignore       |    1 +
 .../{chzyer => ergochat}/readline/LICENSE          |    0
 vendor/github.com/ergochat/readline/Makefile       |   18 +
 vendor/github.com/ergochat/readline/README.md      |   47 +
 vendor/github.com/ergochat/readline/complete.go    |  556 ++++++++
 .../ergochat/readline/complete_helper.go           |  156 +++
 .../{chzyer => ergochat}/readline/history.go       |   66 +-
 .../ergochat/readline/internal/ansi/ansi.go        |    7 +
 .../readline/internal/ansi/ansi_windows.go         |   85 ++
 .../readline/internal/platform/utils_unix.go       |   83 ++
 .../readline/internal/platform/utils_windows.go    |   38 +
 .../ergochat/readline/internal/ringbuf/ringbuf.go  |  222 ++++
 .../readline/internal/runes}/runes.go              |  116 +-
 .../ergochat/readline/internal/term/term.go        |   60 +
 .../ergochat/readline/internal/term/term_plan9.go  |   42 +
 .../ergochat/readline/internal/term/term_unix.go   |   91 ++
 .../readline/internal/term/term_unix_bsd.go        |   12 +
 .../readline/internal/term/term_unix_other.go      |   12 +
 .../readline/internal/term/term_unsupported.go     |   38 +
 .../readline/internal/term/term_windows.go         |   79 ++
 .../ergochat/readline/internal/term/terminal.go    |  986 ++++++++++++++
 vendor/github.com/ergochat/readline/operation.go   |  581 +++++++++
 vendor/github.com/ergochat/readline/readline.go    |  319 +++++
 vendor/github.com/ergochat/readline/runebuf.go     |  684 ++++++++++
 .../{chzyer => ergochat}/readline/search.go        |   97 +-
 vendor/github.com/ergochat/readline/terminal.go    |  490 +++++++
 vendor/github.com/ergochat/readline/undo.go        |   68 +
 vendor/github.com/ergochat/readline/utils.go       |  101 ++
 .../{chzyer => ergochat}/readline/vim.go           |   42 +-
 .../x/sys/internal/unsafeheader/unsafeheader.go    |   30 -
 vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go    |    1 -
 vendor/golang.org/x/sys/plan9/pwd_plan9.go         |    1 -
 vendor/golang.org/x/sys/plan9/race.go              |    1 -
 vendor/golang.org/x/sys/plan9/race0.go             |    1 -
 vendor/golang.org/x/sys/plan9/str.go               |    1 -
 vendor/golang.org/x/sys/plan9/syscall.go           |    1 -
 .../golang.org/x/sys/plan9/zsyscall_plan9_386.go   |    1 -
 .../golang.org/x/sys/plan9/zsyscall_plan9_amd64.go |    1 -
 .../golang.org/x/sys/plan9/zsyscall_plan9_arm.go   |    1 -
 vendor/golang.org/x/sys/unix/aliases.go            |    2 -
 vendor/golang.org/x/sys/unix/asm_aix_ppc64.s       |    1 -
 vendor/golang.org/x/sys/unix/asm_bsd_386.s         |    2 -
 vendor/golang.org/x/sys/unix/asm_bsd_amd64.s       |    2 -
 vendor/golang.org/x/sys/unix/asm_bsd_arm.s         |    2 -
 vendor/golang.org/x/sys/unix/asm_bsd_arm64.s       |    2 -
 vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s       |    2 -
 vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s     |    2 -
 vendor/golang.org/x/sys/unix/asm_linux_386.s       |    1 -
 vendor/golang.org/x/sys/unix/asm_linux_amd64.s     |    1 -
 vendor/golang.org/x/sys/unix/asm_linux_arm.s       |    1 -
 vendor/golang.org/x/sys/unix/asm_linux_arm64.s     |    3 -
 vendor/golang.org/x/sys/unix/asm_linux_loong64.s   |    3 -
 vendor/golang.org/x/sys/unix/asm_linux_mips64x.s   |    3 -
 vendor/golang.org/x/sys/unix/asm_linux_mipsx.s     |    3 -
 vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s    |    3 -
 vendor/golang.org/x/sys/unix/asm_linux_riscv64.s   |    2 -
 vendor/golang.org/x/sys/unix/asm_linux_s390x.s     |    3 -
 vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s  |    1 -
 vendor/golang.org/x/sys/unix/asm_solaris_amd64.s   |    1 -
 vendor/golang.org/x/sys/unix/asm_zos_s390x.s       |    3 -
 vendor/golang.org/x/sys/unix/cap_freebsd.go        |    1 -
 vendor/golang.org/x/sys/unix/constants.go          |    1 -
 vendor/golang.org/x/sys/unix/dev_aix_ppc.go        |    1 -
 vendor/golang.org/x/sys/unix/dev_aix_ppc64.go      |    1 -
 vendor/golang.org/x/sys/unix/dev_zos.go            |    1 -
 vendor/golang.org/x/sys/unix/dirent.go             |    1 -
 vendor/golang.org/x/sys/unix/endian_big.go         |    1 -
 vendor/golang.org/x/sys/unix/endian_little.go      |    1 -
 vendor/golang.org/x/sys/unix/env_unix.go           |    1 -
 vendor/golang.org/x/sys/unix/epoll_zos.go          |    1 -
 vendor/golang.org/x/sys/unix/fcntl.go              |    3 +-
 vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go  |    1 -
 vendor/golang.org/x/sys/unix/fdset.go              |    1 -
 vendor/golang.org/x/sys/unix/fstatfs_zos.go        |    1 -
 vendor/golang.org/x/sys/unix/gccgo.go              |    1 -
 vendor/golang.org/x/sys/unix/gccgo_c.c             |    1 -
 vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go  |    1 -
 vendor/golang.org/x/sys/unix/ifreq_linux.go        |    1 -
 vendor/golang.org/x/sys/unix/ioctl_linux.go        |    5 +
 .../x/sys/unix/{ioctl.go => ioctl_signed.go}       |   34 +-
 .../x/sys/unix/{ioctl.go => ioctl_unsigned.go}     |   20 +-
 vendor/golang.org/x/sys/unix/ioctl_zos.go          |   21 +-
 vendor/golang.org/x/sys/unix/mkall.sh              |    2 +-
 vendor/golang.org/x/sys/unix/mkerrors.sh           |   18 +-
 vendor/golang.org/x/sys/unix/mmap_nomremap.go      |   13 +
 vendor/golang.org/x/sys/unix/mremap.go             |   52 +
 vendor/golang.org/x/sys/unix/pagesize_unix.go      |    1 -
 vendor/golang.org/x/sys/unix/pledge_openbsd.go     |   92 +-
 vendor/golang.org/x/sys/unix/ptrace_darwin.go      |    1 -
 vendor/golang.org/x/sys/unix/ptrace_ios.go         |    1 -
 vendor/golang.org/x/sys/unix/race.go               |    1 -
 vendor/golang.org/x/sys/unix/race0.go              |    1 -
 .../golang.org/x/sys/unix/readdirent_getdents.go   |    1 -
 .../x/sys/unix/readdirent_getdirentries.go         |    1 -
 vendor/golang.org/x/sys/unix/sockcmsg_unix.go      |    1 -
 .../golang.org/x/sys/unix/sockcmsg_unix_other.go   |    1 -
 vendor/golang.org/x/sys/unix/syscall.go            |    1 -
 vendor/golang.org/x/sys/unix/syscall_aix.go        |   28 +-
 vendor/golang.org/x/sys/unix/syscall_aix_ppc.go    |    2 -
 vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go  |    2 -
 vendor/golang.org/x/sys/unix/syscall_bsd.go        |   20 +-
 vendor/golang.org/x/sys/unix/syscall_darwin.go     |  251 +---
 .../golang.org/x/sys/unix/syscall_darwin_amd64.go  |    1 -
 .../golang.org/x/sys/unix/syscall_darwin_arm64.go  |    1 -
 .../x/sys/unix/syscall_darwin_libSystem.go         |    1 -
 vendor/golang.org/x/sys/unix/syscall_dragonfly.go  |  200 +--
 .../x/sys/unix/syscall_dragonfly_amd64.go          |    1 -
 vendor/golang.org/x/sys/unix/syscall_freebsd.go    |  236 +---
 .../golang.org/x/sys/unix/syscall_freebsd_386.go   |   18 +-
 .../golang.org/x/sys/unix/syscall_freebsd_amd64.go |   18 +-
 .../golang.org/x/sys/unix/syscall_freebsd_arm.go   |   16 +-
 .../golang.org/x/sys/unix/syscall_freebsd_arm64.go |   16 +-
 .../x/sys/unix/syscall_freebsd_riscv64.go          |   16 +-
 vendor/golang.org/x/sys/unix/syscall_hurd.go       |    9 +-
 vendor/golang.org/x/sys/unix/syscall_hurd_386.go   |    1 -
 vendor/golang.org/x/sys/unix/syscall_illumos.go    |    1 -
 vendor/golang.org/x/sys/unix/syscall_linux.go      |  299 ++---
 vendor/golang.org/x/sys/unix/syscall_linux_386.go  |   28 -
 .../golang.org/x/sys/unix/syscall_linux_alarm.go   |    2 -
 .../golang.org/x/sys/unix/syscall_linux_amd64.go   |    4 +-
 .../x/sys/unix/syscall_linux_amd64_gc.go           |    1 -
 vendor/golang.org/x/sys/unix/syscall_linux_arm.go  |   28 -
 .../golang.org/x/sys/unix/syscall_linux_arm64.go   |   13 +-
 vendor/golang.org/x/sys/unix/syscall_linux_gc.go   |    1 -
 .../golang.org/x/sys/unix/syscall_linux_gc_386.go  |    1 -
 .../golang.org/x/sys/unix/syscall_linux_gc_arm.go  |    1 -
 .../x/sys/unix/syscall_linux_gccgo_386.go          |    1 -
 .../x/sys/unix/syscall_linux_gccgo_arm.go          |    1 -
 .../golang.org/x/sys/unix/syscall_linux_loong64.go |    8 +-
 .../golang.org/x/sys/unix/syscall_linux_mips64x.go |    5 +-
 .../golang.org/x/sys/unix/syscall_linux_mipsx.go   |   29 -
 vendor/golang.org/x/sys/unix/syscall_linux_ppc.go  |   28 -
 .../golang.org/x/sys/unix/syscall_linux_ppc64x.go  |    3 -
 .../golang.org/x/sys/unix/syscall_linux_riscv64.go |   15 +-
 .../golang.org/x/sys/unix/syscall_linux_s390x.go   |    2 -
 .../golang.org/x/sys/unix/syscall_linux_sparc64.go |    2 -
 vendor/golang.org/x/sys/unix/syscall_netbsd.go     |  279 +---
 vendor/golang.org/x/sys/unix/syscall_netbsd_386.go |    1 -
 .../golang.org/x/sys/unix/syscall_netbsd_amd64.go  |    1 -
 vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go |    1 -
 .../golang.org/x/sys/unix/syscall_netbsd_arm64.go  |    1 -
 vendor/golang.org/x/sys/unix/syscall_openbsd.go    |  121 +-
 .../golang.org/x/sys/unix/syscall_openbsd_386.go   |    1 -
 .../golang.org/x/sys/unix/syscall_openbsd_amd64.go |    1 -
 .../golang.org/x/sys/unix/syscall_openbsd_arm.go   |    1 -
 .../golang.org/x/sys/unix/syscall_openbsd_arm64.go |    1 -
 .../golang.org/x/sys/unix/syscall_openbsd_libc.go  |    1 -
 .../golang.org/x/sys/unix/syscall_openbsd_ppc64.go |    1 -
 .../x/sys/unix/syscall_openbsd_riscv64.go          |    1 -
 vendor/golang.org/x/sys/unix/syscall_solaris.go    |   73 +-
 .../golang.org/x/sys/unix/syscall_solaris_amd64.go |    1 -
 vendor/golang.org/x/sys/unix/syscall_unix.go       |   19 +-
 vendor/golang.org/x/sys/unix/syscall_unix_gc.go    |    2 -
 .../x/sys/unix/syscall_unix_gc_ppc64x.go           |    3 -
 vendor/golang.org/x/sys/unix/syscall_zos_s390x.go  |   24 +-
 vendor/golang.org/x/sys/unix/sysvshm_linux.go      |    1 -
 vendor/golang.org/x/sys/unix/sysvshm_unix.go       |    1 -
 vendor/golang.org/x/sys/unix/sysvshm_unix_other.go |    1 -
 vendor/golang.org/x/sys/unix/timestruct.go         |    1 -
 vendor/golang.org/x/sys/unix/unveil_openbsd.go     |   41 +-
 vendor/golang.org/x/sys/unix/xattr_bsd.go          |    1 -
 vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go    |    1 -
 vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go  |    1 -
 .../golang.org/x/sys/unix/zerrors_darwin_amd64.go  |   20 +-
 .../golang.org/x/sys/unix/zerrors_darwin_arm64.go  |   20 +-
 .../x/sys/unix/zerrors_dragonfly_amd64.go          |    1 -
 .../golang.org/x/sys/unix/zerrors_freebsd_386.go   |    1 -
 .../golang.org/x/sys/unix/zerrors_freebsd_amd64.go |    1 -
 .../golang.org/x/sys/unix/zerrors_freebsd_arm.go   |    1 -
 .../golang.org/x/sys/unix/zerrors_freebsd_arm64.go |    1 -
 .../x/sys/unix/zerrors_freebsd_riscv64.go          |    1 -
 vendor/golang.org/x/sys/unix/zerrors_linux.go      |   90 +-
 vendor/golang.org/x/sys/unix/zerrors_linux_386.go  |   12 +-
 .../golang.org/x/sys/unix/zerrors_linux_amd64.go   |   12 +-
 vendor/golang.org/x/sys/unix/zerrors_linux_arm.go  |   12 +-
 .../golang.org/x/sys/unix/zerrors_linux_arm64.go   |   14 +-
 .../golang.org/x/sys/unix/zerrors_linux_loong64.go |   15 +-
 vendor/golang.org/x/sys/unix/zerrors_linux_mips.go |   12 +-
 .../golang.org/x/sys/unix/zerrors_linux_mips64.go  |   12 +-
 .../x/sys/unix/zerrors_linux_mips64le.go           |   12 +-
 .../golang.org/x/sys/unix/zerrors_linux_mipsle.go  |   12 +-
 vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go  |   12 +-
 .../golang.org/x/sys/unix/zerrors_linux_ppc64.go   |   12 +-
 .../golang.org/x/sys/unix/zerrors_linux_ppc64le.go |   12 +-
 .../golang.org/x/sys/unix/zerrors_linux_riscv64.go |   15 +-
 .../golang.org/x/sys/unix/zerrors_linux_s390x.go   |   12 +-
 .../golang.org/x/sys/unix/zerrors_linux_sparc64.go |   60 +-
 vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go |    1 -
 .../golang.org/x/sys/unix/zerrors_netbsd_amd64.go  |    1 -
 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go |    1 -
 .../golang.org/x/sys/unix/zerrors_netbsd_arm64.go  |    1 -
 .../golang.org/x/sys/unix/zerrors_openbsd_386.go   |    1 -
 .../golang.org/x/sys/unix/zerrors_openbsd_amd64.go |    1 -
 .../golang.org/x/sys/unix/zerrors_openbsd_arm.go   |    1 -
 .../golang.org/x/sys/unix/zerrors_openbsd_arm64.go |    1 -
 .../x/sys/unix/zerrors_openbsd_mips64.go           |    1 -
 .../golang.org/x/sys/unix/zerrors_openbsd_ppc64.go |    1 -
 .../x/sys/unix/zerrors_openbsd_riscv64.go          |    1 -
 .../golang.org/x/sys/unix/zerrors_solaris_amd64.go |    1 -
 vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go  |    1 -
 .../golang.org/x/sys/unix/zptrace_armnn_linux.go   |   10 +-
 .../golang.org/x/sys/unix/zptrace_linux_arm64.go   |    4 +-
 .../golang.org/x/sys/unix/zptrace_mipsnn_linux.go  |   10 +-
 .../x/sys/unix/zptrace_mipsnnle_linux.go           |   10 +-
 vendor/golang.org/x/sys/unix/zptrace_x86_linux.go  |   10 +-
 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go   |   46 +-
 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go |   47 +-
 .../golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go |   18 +-
 .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go         |   19 +-
 .../golang.org/x/sys/unix/zsyscall_darwin_amd64.go |   72 +-
 .../golang.org/x/sys/unix/zsyscall_darwin_amd64.s  |  160 +--
 .../golang.org/x/sys/unix/zsyscall_darwin_arm64.go |   72 +-
 .../golang.org/x/sys/unix/zsyscall_darwin_arm64.s  |  160 +--
 .../x/sys/unix/zsyscall_dragonfly_amd64.go         |   43 +-
 .../golang.org/x/sys/unix/zsyscall_freebsd_386.go  |   53 +-
 .../x/sys/unix/zsyscall_freebsd_amd64.go           |   53 +-
 .../golang.org/x/sys/unix/zsyscall_freebsd_arm.go  |   53 +-
 .../x/sys/unix/zsyscall_freebsd_arm64.go           |   53 +-
 .../x/sys/unix/zsyscall_freebsd_riscv64.go         |   53 +-
 .../x/sys/unix/zsyscall_illumos_amd64.go           |   11 +-
 vendor/golang.org/x/sys/unix/zsyscall_linux.go     |  115 +-
 vendor/golang.org/x/sys/unix/zsyscall_linux_386.go |   11 -
 .../golang.org/x/sys/unix/zsyscall_linux_amd64.go  |   11 -
 vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go |   11 -
 .../golang.org/x/sys/unix/zsyscall_linux_arm64.go  |   11 -
 .../x/sys/unix/zsyscall_linux_loong64.go           |    1 -
 .../golang.org/x/sys/unix/zsyscall_linux_mips.go   |   11 -
 .../golang.org/x/sys/unix/zsyscall_linux_mips64.go |   11 -
 .../x/sys/unix/zsyscall_linux_mips64le.go          |   11 -
 .../golang.org/x/sys/unix/zsyscall_linux_mipsle.go |   11 -
 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go |   11 -
 .../golang.org/x/sys/unix/zsyscall_linux_ppc64.go  |   11 -
 .../x/sys/unix/zsyscall_linux_ppc64le.go           |   11 -
 .../x/sys/unix/zsyscall_linux_riscv64.go           |   27 +-
 .../golang.org/x/sys/unix/zsyscall_linux_s390x.go  |   11 -
 .../x/sys/unix/zsyscall_linux_sparc64.go           |   11 -
 .../golang.org/x/sys/unix/zsyscall_netbsd_386.go   |   50 +-
 .../golang.org/x/sys/unix/zsyscall_netbsd_amd64.go |   50 +-
 .../golang.org/x/sys/unix/zsyscall_netbsd_arm.go   |   50 +-
 .../golang.org/x/sys/unix/zsyscall_netbsd_arm64.go |   50 +-
 .../golang.org/x/sys/unix/zsyscall_openbsd_386.go  |  118 +-
 .../golang.org/x/sys/unix/zsyscall_openbsd_386.s   |   35 +-
 .../x/sys/unix/zsyscall_openbsd_amd64.go           |  118 +-
 .../golang.org/x/sys/unix/zsyscall_openbsd_amd64.s |   35 +-
 .../golang.org/x/sys/unix/zsyscall_openbsd_arm.go  |  118 +-
 .../golang.org/x/sys/unix/zsyscall_openbsd_arm.s   |   35 +-
 .../x/sys/unix/zsyscall_openbsd_arm64.go           |  118 +-
 .../golang.org/x/sys/unix/zsyscall_openbsd_arm64.s |   35 +-
 .../x/sys/unix/zsyscall_openbsd_mips64.go          |  118 +-
 .../x/sys/unix/zsyscall_openbsd_mips64.s           |   35 +-
 .../x/sys/unix/zsyscall_openbsd_ppc64.go           |  118 +-
 .../golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s |   42 +-
 .../x/sys/unix/zsyscall_openbsd_riscv64.go         |  118 +-
 .../x/sys/unix/zsyscall_openbsd_riscv64.s          |   35 +-
 .../x/sys/unix/zsyscall_solaris_amd64.go           |  281 ++--
 vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go |   24 +-
 .../golang.org/x/sys/unix/zsysctl_openbsd_386.go   |    1 -
 .../golang.org/x/sys/unix/zsysctl_openbsd_amd64.go |    1 -
 .../golang.org/x/sys/unix/zsysctl_openbsd_arm.go   |    1 -
 .../golang.org/x/sys/unix/zsysctl_openbsd_arm64.go |    1 -
 .../x/sys/unix/zsysctl_openbsd_mips64.go           |    1 -
 .../golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go |    1 -
 .../x/sys/unix/zsysctl_openbsd_riscv64.go          |    1 -
 .../golang.org/x/sys/unix/zsysnum_darwin_amd64.go  |    1 -
 .../golang.org/x/sys/unix/zsysnum_darwin_arm64.go  |    1 -
 .../x/sys/unix/zsysnum_dragonfly_amd64.go          |    1 -
 .../golang.org/x/sys/unix/zsysnum_freebsd_386.go   |    1 -
 .../golang.org/x/sys/unix/zsysnum_freebsd_amd64.go |    1 -
 .../golang.org/x/sys/unix/zsysnum_freebsd_arm.go   |    1 -
 .../golang.org/x/sys/unix/zsysnum_freebsd_arm64.go |    1 -
 .../x/sys/unix/zsysnum_freebsd_riscv64.go          |    1 -
 vendor/golang.org/x/sys/unix/zsysnum_linux_386.go  |    3 +-
 .../golang.org/x/sys/unix/zsysnum_linux_amd64.go   |    4 +-
 vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go  |    3 +-
 .../golang.org/x/sys/unix/zsysnum_linux_arm64.go   |    3 +-
 .../golang.org/x/sys/unix/zsysnum_linux_loong64.go |    3 +-
 vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go |    3 +-
 .../golang.org/x/sys/unix/zsysnum_linux_mips64.go  |    3 +-
 .../x/sys/unix/zsysnum_linux_mips64le.go           |    3 +-
 .../golang.org/x/sys/unix/zsysnum_linux_mipsle.go  |    3 +-
 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go  |    3 +-
 .../golang.org/x/sys/unix/zsysnum_linux_ppc64.go   |    3 +-
 .../golang.org/x/sys/unix/zsysnum_linux_ppc64le.go |    3 +-
 .../golang.org/x/sys/unix/zsysnum_linux_riscv64.go |    5 +-
 .../golang.org/x/sys/unix/zsysnum_linux_s390x.go   |    4 +-
 .../golang.org/x/sys/unix/zsysnum_linux_sparc64.go |    3 +-
 vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go |    1 -
 .../golang.org/x/sys/unix/zsysnum_netbsd_amd64.go  |    1 -
 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go |    1 -
 .../golang.org/x/sys/unix/zsysnum_netbsd_arm64.go  |    1 -
 .../golang.org/x/sys/unix/zsysnum_openbsd_386.go   |    1 -
 .../golang.org/x/sys/unix/zsysnum_openbsd_amd64.go |    1 -
 .../golang.org/x/sys/unix/zsysnum_openbsd_arm.go   |    1 -
 .../golang.org/x/sys/unix/zsysnum_openbsd_arm64.go |    1 -
 .../x/sys/unix/zsysnum_openbsd_mips64.go           |    1 -
 .../golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go |    1 -
 .../x/sys/unix/zsysnum_openbsd_riscv64.go          |    1 -
 vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go  |    1 -
 vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go     |    1 -
 vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go   |    1 -
 .../golang.org/x/sys/unix/ztypes_darwin_amd64.go   |   12 +-
 .../golang.org/x/sys/unix/ztypes_darwin_arm64.go   |   12 +-
 .../x/sys/unix/ztypes_dragonfly_amd64.go           |    1 -
 vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go |    3 +-
 .../golang.org/x/sys/unix/ztypes_freebsd_amd64.go  |    3 +-
 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go |    3 +-
 .../golang.org/x/sys/unix/ztypes_freebsd_arm64.go  |    3 +-
 .../x/sys/unix/ztypes_freebsd_riscv64.go           |    3 +-
 vendor/golang.org/x/sys/unix/ztypes_linux.go       |  270 +++-
 vendor/golang.org/x/sys/unix/ztypes_linux_386.go   |    5 +-
 vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go |    5 +-
 vendor/golang.org/x/sys/unix/ztypes_linux_arm.go   |    5 +-
 vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go |    5 +-
 .../golang.org/x/sys/unix/ztypes_linux_loong64.go  |    5 +-
 vendor/golang.org/x/sys/unix/ztypes_linux_mips.go  |    5 +-
 .../golang.org/x/sys/unix/ztypes_linux_mips64.go   |    5 +-
 .../golang.org/x/sys/unix/ztypes_linux_mips64le.go |    5 +-
 .../golang.org/x/sys/unix/ztypes_linux_mipsle.go   |    5 +-
 vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go   |    5 +-
 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go |    5 +-
 .../golang.org/x/sys/unix/ztypes_linux_ppc64le.go  |    5 +-
 .../golang.org/x/sys/unix/ztypes_linux_riscv64.go  |   32 +-
 vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go |    5 +-
 .../golang.org/x/sys/unix/ztypes_linux_sparc64.go  |    5 +-
 vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go  |    1 -
 .../golang.org/x/sys/unix/ztypes_netbsd_amd64.go   |    1 -
 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go  |    1 -
 .../golang.org/x/sys/unix/ztypes_netbsd_arm64.go   |    1 -
 vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go |    1 -
 .../golang.org/x/sys/unix/ztypes_openbsd_amd64.go  |    1 -
 vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go |    1 -
 .../golang.org/x/sys/unix/ztypes_openbsd_arm64.go  |    1 -
 .../golang.org/x/sys/unix/ztypes_openbsd_mips64.go |    1 -
 .../golang.org/x/sys/unix/ztypes_openbsd_ppc64.go  |    1 -
 .../x/sys/unix/ztypes_openbsd_riscv64.go           |    1 -
 .../golang.org/x/sys/unix/ztypes_solaris_amd64.go  |    1 -
 vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go   |    1 -
 vendor/golang.org/x/sys/windows/aliases.go         |    1 -
 vendor/golang.org/x/sys/windows/empty.s            |    1 -
 vendor/golang.org/x/sys/windows/env_windows.go     |    6 +-
 vendor/golang.org/x/sys/windows/eventlog.go        |    1 -
 vendor/golang.org/x/sys/windows/exec_windows.go    |   92 +-
 vendor/golang.org/x/sys/windows/mksyscall.go       |    1 -
 vendor/golang.org/x/sys/windows/race.go            |    1 -
 vendor/golang.org/x/sys/windows/race0.go           |    1 -
 .../golang.org/x/sys/windows/security_windows.go   |   21 +-
 vendor/golang.org/x/sys/windows/service.go         |   12 +-
 vendor/golang.org/x/sys/windows/str.go             |    1 -
 vendor/golang.org/x/sys/windows/syscall.go         |    1 -
 vendor/golang.org/x/sys/windows/syscall_windows.go |   82 +-
 vendor/golang.org/x/sys/windows/types_windows.go   |  130 +-
 .../golang.org/x/sys/windows/zsyscall_windows.go   |  126 +-
 vendor/golang.org/x/text/LICENSE                   |   27 +
 vendor/golang.org/x/text/PATENTS                   |   22 +
 vendor/golang.org/x/text/transform/transform.go    |  709 ++++++++++
 vendor/golang.org/x/text/width/kind_string.go      |   28 +
 vendor/golang.org/x/text/width/tables10.0.0.go     | 1329 +++++++++++++++++++
 vendor/golang.org/x/text/width/tables11.0.0.go     | 1341 +++++++++++++++++++
 vendor/golang.org/x/text/width/tables12.0.0.go     | 1361 +++++++++++++++++++
 vendor/golang.org/x/text/width/tables13.0.0.go     | 1362 ++++++++++++++++++++
 vendor/golang.org/x/text/width/tables9.0.0.go      | 1297 +++++++++++++++++++
 vendor/golang.org/x/text/width/transform.go        |  239 ++++
 vendor/golang.org/x/text/width/trieval.go          |   30 +
 vendor/golang.org/x/text/width/width.go            |  206 +++
 vendor/modules.txt                                 |   20 +-
 400 files changed, 16293 insertions(+), 8138 deletions(-)

diff --git a/.rat-excludes b/.rat-excludes
index 3ecb402..dd935e5 100644
--- a/.rat-excludes
+++ b/.rat-excludes
@@ -4,4 +4,5 @@ apache-rat-0.17
 go.sum
 rat-report.txt
 /snap/snapcraft.yaml
-vendor
\ No newline at end of file
+vendor
+**/*.patch
\ No newline at end of file
diff --git a/Makefile b/Makefile
index ee8b657..d8370f6 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,22 @@ run: all
 debug:
 	$(GO) build -mod=vendor -gcflags='-N -l' -o cmk &&  dlv --listen=:2345 --headless=true --api-version=2 exec ./cmk
 
+.PHONY: vendor-patch
+vendor-patch: ## Refresh vendor/ and re-apply the local patches in patches/
+	$(info $(M) Refreshing vendor/ and re-applying local patches…)
+	$Q $(GO) mod vendor
+	$Q for p in patches/*.patch; do git apply "$$p" || exit 1; done
+	$Q echo "$(M) Done! See patches/README.md"
+
+.PHONY: vendor-check
+vendor-check: ## Verify vendor/ still carries the local patches in patches/
+	$(info $(M) Checking local patches are present in vendor/…)
+	$Q for p in patches/*.patch; do \
+		git apply --reverse --check "$$p" || { \
+			echo "ERROR: $$p is not applied to vendor/; run 'make vendor-patch'"; exit 1; }; \
+	done
+	$Q echo "$(M) All local patches present"
+
 dist-mkdir: all
 	rm -fr dist
 	mkdir -p dist
diff --git a/cli/prompt.go b/cli/prompt.go
index 8d3813d..eede4b5 100644
--- a/cli/prompt.go
+++ b/cli/prompt.go
@@ -23,7 +23,7 @@ import (
 	"strings"
 
 	"github.com/apache/cloudstack-cloudmonkey/config"
-	"github.com/chzyer/readline"
+	"github.com/ergochat/readline"
 )
 
 // CLI config instance
diff --git a/go.mod b/go.mod
index 2ab0eff..84f280f 100644
--- a/go.mod
+++ b/go.mod
@@ -21,7 +21,7 @@ go 1.20
 
 require (
 	github.com/briandowns/spinner v1.22.0
-	github.com/chzyer/readline v1.5.1
+	github.com/ergochat/readline v0.1.3
 	github.com/gofrs/flock v0.8.1
 	github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
 	github.com/mitchellh/go-homedir v1.1.0
@@ -37,7 +37,8 @@ require (
 	github.com/mattn/go-runewidth v0.0.14 // indirect
 	github.com/rivo/uniseg v0.4.4 // indirect
 	github.com/stretchr/testify v1.8.2 // indirect
-	golang.org/x/sys v0.5.0 // indirect
+	golang.org/x/sys v0.15.0 // indirect
 	golang.org/x/term v0.5.0 // indirect
+	golang.org/x/text v0.9.0 // indirect
 	gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
 )
diff --git a/go.sum b/go.sum
index 6a2edfc..1bcef77 100644
--- a/go.sum
+++ b/go.sum
@@ -1,14 +1,10 @@
 github.com/briandowns/spinner v1.22.0 h1:fJ/7tyeM2q9ebM57kGfjnUSrgPJBsULk+/s61UpMGrw=
 github.com/briandowns/spinner v1.22.0/go.mod h1:rPG4gmXeN3wQV/TsAY4w8lPdIM6RX3yqeBQJSrbXjuE=
-github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM=
-github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
-github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI=
-github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk=
-github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04=
-github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/ergochat/readline v0.1.3 h1:/DytGTmwdUJcLAe3k3VJgowh5vNnsdifYT6uVaf4pSo=
+github.com/ergochat/readline v0.1.3/go.mod h1:o3ux9QLHLm77bq7hDB21UTm6HlV2++IPDMfIfKDuOgY=
 github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
 github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
 github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw=
@@ -44,12 +40,13 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
 github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
 github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
 github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
-golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
-golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
+golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
 golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
+golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
+golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
diff --git a/patches/README.md b/patches/README.md
new file mode 100644
index 0000000..296ebb5
--- /dev/null
+++ b/patches/README.md
@@ -0,0 +1,91 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Local patches to vendored dependencies
+
+Some files under `vendor/` carry local changes that are **not** present in the
+upstream release. Running `go mod vendor` reverts them silently — the build
+still succeeds, but the resulting binary loses the fixes. Every local change
+must therefore be recorded here.
+
+After any `go mod vendor`, re-apply the patches:
+
+    make vendor-patch
+
+which is equivalent to:
+
+    go mod vendor
+    git apply patches/*.patch
+
+## `ergochat-readline-v0.1.3.patch`
+
+Applies to `github.com/ergochat/readline` v0.1.3. Three changes:
+
+### 1. `complete.go` — insert the value, display the detail
+
+CloudMonkey builds completion candidates as `<value> (<detail>)` so the user
+can see what a UUID refers to (see `cli/completer.go`). Upstream's
+`AutoCompleter.Do` returns a single slice that is used both for display *and*
+for insertion, so without this patch the ` (<detail>)` suffix is written into
+the command line.
+
+`writeRunes` strips everything from the ` … (` boundary before inserting, and
+`truncateBufferAfterLastEqual` drops the partial text after the last `=` when
+the candidate matched on its detail rather than on its value.
+
+Originally added for #133 and #196 against `chzyer/readline`; forward-ported
+when the library was switched to `ergochat/readline`.
+
+### 2. `complete.go` — redraw the prompt in `CompleteRefresh`
+
+The `\033[J` erase issued while rendering the candidate grid can clear the
+prompt line, leaving the prompt blank until the next keystroke. The patch
+redraws the prompt and buffer contents after the erase.
+
+This is an upstream rendering bug, not a CloudMonkey-specific need.
+
+### 3. `operation.go` — bound the cursor position query
+
+`Runes()` calls `getAndSetOffset(nil)` before printing every prompt, which
+sends a DSR cursor position request (`ESC[6n`) and blocks on the reply with a
+nil deadline — i.e. forever. Under a pty whose emulator never answers
+(`expect`, `pexpect`, Ansible with a pty, some CI runners) `cmk` prints its
+banner and then hangs with no prompt.
+
+The patch passes a deadline of `dsrTimeout` (250ms, the constant upstream
+already uses in `waitForDSR`). On expiry `GetCursorPosition` returns an error,
+`getAndSetOffset` leaves the offset unchanged and the prompt is printed anyway.
+A late CPR reply is still recognised and discarded by `consumeANSIEscape`, so
+it is never mistaken for user input.
+
+The timeout would otherwise be paid before *every* prompt, so the result is
+latched: on `deadlineExceeded` the `dsrUnsupported` flag is set and no further
+queries are made for the life of the session. A terminal that answers — even
+one that takes 150ms to do so — never sets the flag and keeps full offset
+tracking on every prompt. The tradeoff is that a terminal which misses one
+query and then recovers stays latched off for the session; the consequence is
+cosmetic (the prompt may overwrite pre-existing text on the line) and real
+emulators answer CPR synchronously, so a one-off miss is not expected.
+
+## Upstream status
+
+None of these are fixed in `ergochat/readline` v0.1.3, which has been the
+latest release since September 2024. Changes 2 and 3 are general bugs and
+should be reported upstream so this patch can shrink; change 1 needs an
+upstream API that separates a candidate's display text from its insert text.
diff --git a/patches/ergochat-readline-v0.1.3.patch b/patches/ergochat-readline-v0.1.3.patch
new file mode 100644
index 0000000..2e5914e
--- /dev/null
+++ b/patches/ergochat-readline-v0.1.3.patch
@@ -0,0 +1,175 @@
+--- a/vendor/github.com/ergochat/readline/complete.go
++++ b/vendor/github.com/ergochat/readline/complete.go
+@@ -4,6 +4,7 @@
+ 	"bufio"
+ 	"bytes"
+ 	"fmt"
++	"strings"
+ 	"sync/atomic"
+ 
+ 	"github.com/ergochat/readline/internal/platform"
+@@ -46,9 +47,38 @@
+ 	}
+ }
+ 
++func (o *opCompleter) truncateBufferAfterLastEqual(completion []rune) {
++	bufRunes := o.op.buf.Runes()
++	for i := len(bufRunes) - 1; i >= 0; i-- {
++		if bufRunes[i] == '=' {
++			prefix := bufRunes[i+1:] // part after '=' in buffer
++			if len(prefix) > 0 && len(completion) >= len(prefix) && string(completion[:len(prefix)]) == string(prefix) {
++				o.op.buf.Set(bufRunes[:i+1]) // Keep content till '='
++			}
++			break
++		}
++	}
++}
++
++func (o *opCompleter) writeRunes(candidate []rune) {
++	selected := candidate
++	spaceFound := false
++	for idx, r := range candidate {
++		if r == ' ' {
++			spaceFound = true
++		}
++		if spaceFound && r == '(' {
++			o.truncateBufferAfterLastEqual(candidate[idx+1:])
++			selected = candidate[:idx]
++			break
++		}
++	}
++	o.op.buf.WriteRunes(selected)
++}
++
+ func (o *opCompleter) doSelect() {
+ 	if len(o.candidate) == 1 {
+-		o.op.buf.WriteRunes(o.candidate[0])
++		o.writeRunes(o.candidate[0])
+ 		o.ExitCompleteMode(false)
+ 		return
+ 	}
+@@ -232,7 +262,7 @@
+ 	if !o.IsInCompleteMode() {
+ 		if len(newLines) == 1 {
+ 			// not yet in complete mode but only 1 candidate so complete it
+-			buf.WriteRunes(newLines[0])
++			o.writeRunes(newLines[0])
+ 			o.ExitCompleteMode(false)
+ 			return true
+ 		}
+@@ -264,7 +294,7 @@
+ 	switch r {
+ 	case CharEnter, CharCtrlJ:
+ 		next = false
+-		o.op.buf.WriteRunes(o.candidate[o.candidateChoice])
++		o.writeRunes(o.candidate[o.candidateChoice])
+ 		o.ExitCompleteMode(false)
+ 	case CharLineStart:
+ 		o.lineStart()
+@@ -459,6 +489,33 @@
+ 
+ 	// wrote out choices over "lines", move back to cursor (positioned at index)
+ 	fmt.Fprintf(buf, "\033[%dA", lines)
++
++	// Redraw the prompt and buffer since \033[J may have cleared them
++	// Calculate which line the cursor is on (0-indexed, where 0 is the prompt line)
++	cursorLine := o.op.buf.IdxLine(tWidth)
++
++	// Move to the beginning of the prompt line (line 0)
++	if cursorLine > 0 {
++		fmt.Fprintf(buf, "\033[%dA", cursorLine)
++	}
++	// Move to column 1 to redraw from the start
++	buf.WriteString("\033[1G")
++	// Redraw prompt and buffer content
++	cfg := o.op.GetConfig()
++	buf.WriteString(cfg.Prompt)
++	buf.WriteString("\x1b[0K") // Clear line from cursor right
++	rs := o.op.buf.Runes()
++	for _, e := range cfg.Painter(rs, o.op.buf.Pos()) {
++		if e == '\t' {
++			buf.WriteString(strings.Repeat(" ", runes.TabWidth))
++		} else {
++			buf.WriteRune(e)
++		}
++	}
++	// Now position cursor correctly - move back down to the cursor line
++	if cursorLine > 0 {
++		fmt.Fprintf(buf, "\033[%dB", cursorLine)
++	}
+ 	buf.Write(o.op.buf.getBackspaceSequence())
+ 	buf.Flush()
+ }
+--- a/vendor/github.com/ergochat/readline/operation.go
++++ b/vendor/github.com/ergochat/readline/operation.go
+@@ -5,6 +5,7 @@
+ 	"io"
+ 	"sync"
+ 	"sync/atomic"
++	"time"
+ 
+ 	"github.com/ergochat/readline/internal/platform"
+ 	"github.com/ergochat/readline/internal/runes"
+@@ -23,6 +24,12 @@
+ 
+ 	isPrompting bool // true when prompt written and waiting for input
+ 
++	// dsrUnsupported is set once a cursor position query has timed out. The
++	// terminal is then assumed not to implement DSR and no further queries
++	// are made, so the timeout is paid at most once per session rather than
++	// before every prompt. Read and written under m, via getAndSetOffset.
++	dsrUnsupported bool
++
+ 	history   *opHistory
+ 	search    *opSearch
+ 	completer *opCompleter
+@@ -419,7 +426,10 @@
+ 	// Query cursor position before printing the prompt as there
+ 	// may be existing text on the same line that ideally we don't
+ 	// want to overwrite and cause prompt to jump left.
+-	o.getAndSetOffset(nil)
++	// Bound the query: a pty that never answers the DSR request (expect,
++	// pexpect, Ansible with a pty, some CI runners) would otherwise block
++	// here forever and no prompt would ever be printed.
++	o.getAndSetOffset(newDSRDeadline())
+ 	o.buf.Print() // print prompt & buffer contents
+ 	// Prompt written safely, unlock until read completes and then
+ 	// lock again to unset.
+@@ -440,7 +450,7 @@
+ }
+ 
+ func (o *operation) getAndSetOffset(deadline chan struct{}) {
+-	if !o.GetConfig().isInteractive {
++	if !o.GetConfig().isInteractive || o.dsrUnsupported {
+ 		return
+ 	}
+ 
+@@ -451,11 +461,27 @@
+ 	// TODO ???
+ 	o.t.Write([]byte(" \b"))
+ 
+-	if offset, err := o.t.GetCursorPosition(deadline); err == nil {
++	offset, err := o.t.GetCursorPosition(deadline)
++	switch {
++	case err == nil:
+ 		o.buf.SetOffset(offset)
++	case errors.Is(err, deadlineExceeded):
++		// The terminal did not answer in time; assume it never will and
++		// stop querying, so the timeout is not paid before every prompt.
++		o.dsrUnsupported = true
+ 	}
+ }
+ 
++// newDSRDeadline returns a channel that closes once dsrTimeout has elapsed,
++// bounding how long a cursor position query will wait for the terminal to
++// answer. On expiry GetCursorPosition returns an error, the offset is left
++// unchanged and the prompt is printed anyway.
++func newDSRDeadline() chan struct{} {
++	deadline := make(chan struct{})
++	time.AfterFunc(dsrTimeout, func() { close(deadline) })
++	return deadline
++}
++
+ func (o *operation) GenPasswordConfig() *Config {
+ 	baseConfig := o.GetConfig()
+ 	return &Config{
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 374fb69..1b9ce6d 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -53,8 +53,9 @@ parts:
       cd "$CRAFT_PART_SRC"
       SHORT_SHA="$(cat .remote-sha 2>/dev/null || echo unknown)"
       BUILD_DATE="$(date +%FT%T%z)"
-      go mod vendor || true
-      go build -trimpath \
+      # Do not run "go mod vendor" here: vendor/ is committed and carries local
+      # patches that regenerating it would silently revert. See patches/README.md.
+      go build -trimpath -mod=vendor \
         -ldflags "-s -w -X main.GitSHA=${SHORT_SHA} -X main.BuildDate=${BUILD_DATE}" \
         -o cmk cmk.go
       install -Dm0755 cmk "$CRAFT_PART_INSTALL/bin/cmk"
diff --git a/vendor/github.com/chzyer/readline/.travis.yml b/vendor/github.com/chzyer/readline/.travis.yml
deleted file mode 100644
index 9c35955..0000000
--- a/vendor/github.com/chzyer/readline/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: go
-go:
-  - 1.x
-script:
-  - GOOS=windows go install github.com/chzyer/readline/example/...
-  - GOOS=linux go install github.com/chzyer/readline/example/...
-  - GOOS=darwin go install github.com/chzyer/readline/example/...
-  - go test -race -v
diff --git a/vendor/github.com/chzyer/readline/CHANGELOG.md b/vendor/github.com/chzyer/readline/CHANGELOG.md
deleted file mode 100644
index 14ff5be..0000000
--- a/vendor/github.com/chzyer/readline/CHANGELOG.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# ChangeLog
-
-### 1.4 - 2016-07-25
-
-* [#60][60] Support dynamic autocompletion
-* Fix ANSI parser on Windows
-* Fix wrong column width in complete mode on Windows
-* Remove dependent package "golang.org/x/crypto/ssh/terminal"
-
-### 1.3 - 2016-05-09
-
-* [#38][38] add SetChildren for prefix completer interface
-* [#42][42] improve multiple lines compatibility
-* [#43][43] remove sub-package(runes) for gopkg compatibility
-* [#46][46] Auto complete with space prefixed line
-* [#48][48]	support suspend process (ctrl+Z)
-* [#49][49] fix bug that check equals with previous command
-* [#53][53] Fix bug which causes integer divide by zero panicking when input buffer is empty
-
-### 1.2 - 2016-03-05
-
-* Add a demo for checking password strength [example/readline-pass-strength](https://github.com/chzyer/readline/blob/master/example/readline-pass-strength/readline-pass-strength.go), , written by [@sahib](https://github.com/sahib)
-* [#23][23], support stdin remapping
-* [#27][27], add a `UniqueEditLine` to `Config`, which will erase the editing line after user submited it, usually use in IM.
-* Add a demo for multiline [example/readline-multiline](https://github.com/chzyer/readline/blob/master/example/readline-multiline/readline-multiline.go) which can submit one SQL by multiple lines.
-* Supports performs even stdin/stdout is not a tty.
-* Add a new simple apis for single instance, check by [here](https://github.com/chzyer/readline/blob/master/std.go). It need to save history manually if using this api.
-* [#28][28], fixes the history is not working as expected.
-* [#33][33], vim mode now support `c`, `d`, `x (delete character)`, `r (replace character)`
-
-### 1.1 - 2015-11-20
-
-* [#12][12] Add support for key `<Delete>`/`<Home>`/`<End>`
-* Only enter raw mode as needed (calling `Readline()`), program will receive signal(e.g. Ctrl+C) if not interact with `readline`.
-* Bugs fixed for `PrefixCompleter`
-* Press `Ctrl+D` in empty line will cause `io.EOF` in error, Press `Ctrl+C` in anytime will cause `ErrInterrupt` instead of `io.EOF`, this will privodes a shell-like user experience.
-* Customable Interrupt/EOF prompt in `Config`
-* [#17][17] Change atomic package to use 32bit function to let it runnable on arm 32bit devices
-* Provides a new password user experience(`readline.ReadPasswordEx()`).
-
-### 1.0 - 2015-10-14
-
-* Initial public release.
-
-[12]: https://github.com/chzyer/readline/pull/12
-[17]: https://github.com/chzyer/readline/pull/17
-[23]: https://github.com/chzyer/readline/pull/23
-[27]: https://github.com/chzyer/readline/pull/27
-[28]: https://github.com/chzyer/readline/pull/28
-[33]: https://github.com/chzyer/readline/pull/33
-[38]: https://github.com/chzyer/readline/pull/38
-[42]: https://github.com/chzyer/readline/pull/42
-[43]: https://github.com/chzyer/readline/pull/43
-[46]: https://github.com/chzyer/readline/pull/46
-[48]: https://github.com/chzyer/readline/pull/48
-[49]: https://github.com/chzyer/readline/pull/49
-[53]: https://github.com/chzyer/readline/pull/53
-[60]: https://github.com/chzyer/readline/pull/60
diff --git a/vendor/github.com/chzyer/readline/README.md b/vendor/github.com/chzyer/readline/README.md
deleted file mode 100644
index 4b0a5ff..0000000
--- a/vendor/github.com/chzyer/readline/README.md
+++ /dev/null
@@ -1,114 +0,0 @@
-[![Build Status](https://travis-ci.org/chzyer/readline.svg?branch=master)](https://travis-ci.org/chzyer/readline)
-[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md)
-[![Version](https://img.shields.io/github/tag/chzyer/readline.svg)](https://github.com/chzyer/readline/releases)
-[![GoDoc](https://godoc.org/github.com/chzyer/readline?status.svg)](https://godoc.org/github.com/chzyer/readline)
-[![OpenCollective](https://opencollective.com/readline/badge/backers.svg)](#backers)
-[![OpenCollective](https://opencollective.com/readline/badge/sponsors.svg)](#sponsors)
-
-<p align="center">
-<img src="https://raw.githubusercontent.com/chzyer/readline/assets/logo.png" />
-<a href="https://asciinema.org/a/32oseof9mkilg7t7d4780qt4m" target="_blank"><img src="https://asciinema.org/a/32oseof9mkilg7t7d4780qt4m.png" width="654"/></a>
-<img src="https://raw.githubusercontent.com/chzyer/readline/assets/logo_f.png" />
-</p>
-
-A powerful readline library in `Linux` `macOS` `Windows` `Solaris` `AIX`
-
-## Guide
-
-* [Demo](example/readline-demo/readline-demo.go)
-* [Shortcut](doc/shortcut.md)
-
-## Repos using readline
-
-[![cockroachdb](https://img.shields.io/github/stars/cockroachdb/cockroach.svg?label=cockroachdb/cockroach)](https://github.com/cockroachdb/cockroach)
-[![robertkrimen/otto](https://img.shields.io/github/stars/robertkrimen/otto.svg?label=robertkrimen/otto)](https://github.com/robertkrimen/otto)
-[![empire](https://img.shields.io/github/stars/remind101/empire.svg?label=remind101/empire)](https://github.com/remind101/empire)
-[![mehrdadrad/mylg](https://img.shields.io/github/stars/mehrdadrad/mylg.svg?label=mehrdadrad/mylg)](https://github.com/mehrdadrad/mylg)
-[![knq/usql](https://img.shields.io/github/stars/knq/usql.svg?label=knq/usql)](https://github.com/knq/usql)
-[![youtube/doorman](https://img.shields.io/github/stars/youtube/doorman.svg?label=youtube/doorman)](https://github.com/youtube/doorman)
-[![bom-d-van/harp](https://img.shields.io/github/stars/bom-d-van/harp.svg?label=bom-d-van/harp)](https://github.com/bom-d-van/harp)
-[![abiosoft/ishell](https://img.shields.io/github/stars/abiosoft/ishell.svg?label=abiosoft/ishell)](https://github.com/abiosoft/ishell)
-[![Netflix/hal-9001](https://img.shields.io/github/stars/Netflix/hal-9001.svg?label=Netflix/hal-9001)](https://github.com/Netflix/hal-9001)
-[![docker/go-p9p](https://img.shields.io/github/stars/docker/go-p9p.svg?label=docker/go-p9p)](https://github.com/docker/go-p9p)
-
-
-## Feedback
-
-If you have any questions, please submit a github issue and any pull requests is welcomed :)
-
-* [https://twitter.com/chzyer](https://twitter.com/chzyer)
-* [http://weibo.com/2145262190](http://weibo.com/2145262190)
-
-
-## Backers
-
-Love Readline? Help me keep it alive by donating funds to cover project expenses!<br />
-[[Become a backer](https://opencollective.com/readline#backer)]
-
-<a href="https://opencollective.com/readline/backer/0/website" target="_blank"><img src="https://opencollective.com/readline/backer/0/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/1/website" target="_blank"><img src="https://opencollective.com/readline/backer/1/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/2/website" target="_blank"><img src="https://opencollective.com/readline/backer/2/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/3/website" target="_blank"><img src="https://opencollective.com/readline/backer/3/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/4/website" target="_blank"><img src="https://opencollective.com/readline/backer/4/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/5/website" target="_blank"><img src="https://opencollective.com/readline/backer/5/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/6/website" target="_blank"><img src="https://opencollective.com/readline/backer/6/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/7/website" target="_blank"><img src="https://opencollective.com/readline/backer/7/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/8/website" target="_blank"><img src="https://opencollective.com/readline/backer/8/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/9/website" target="_blank"><img src="https://opencollective.com/readline/backer/9/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/10/website" target="_blank"><img src="https://opencollective.com/readline/backer/10/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/11/website" target="_blank"><img src="https://opencollective.com/readline/backer/11/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/12/website" target="_blank"><img src="https://opencollective.com/readline/backer/12/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/13/website" target="_blank"><img src="https://opencollective.com/readline/backer/13/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/14/website" target="_blank"><img src="https://opencollective.com/readline/backer/14/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/15/website" target="_blank"><img src="https://opencollective.com/readline/backer/15/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/16/website" target="_blank"><img src="https://opencollective.com/readline/backer/16/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/17/website" target="_blank"><img src="https://opencollective.com/readline/backer/17/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/18/website" target="_blank"><img src="https://opencollective.com/readline/backer/18/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/19/website" target="_blank"><img src="https://opencollective.com/readline/backer/19/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/20/website" target="_blank"><img src="https://opencollective.com/readline/backer/20/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/21/website" target="_blank"><img src="https://opencollective.com/readline/backer/21/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/22/website" target="_blank"><img src="https://opencollective.com/readline/backer/22/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/23/website" target="_blank"><img src="https://opencollective.com/readline/backer/23/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/24/website" target="_blank"><img src="https://opencollective.com/readline/backer/24/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/25/website" target="_blank"><img src="https://opencollective.com/readline/backer/25/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/26/website" target="_blank"><img src="https://opencollective.com/readline/backer/26/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/27/website" target="_blank"><img src="https://opencollective.com/readline/backer/27/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/28/website" target="_blank"><img src="https://opencollective.com/readline/backer/28/avatar.svg"></a>
-<a href="https://opencollective.com/readline/backer/29/website" target="_blank"><img src="https://opencollective.com/readline/backer/29/avatar.svg"></a>
-
-
-## Sponsors
-
-Become a sponsor and get your logo here on our Github page. [[Become a sponsor](https://opencollective.com/readline#sponsor)]
-
-<a href="https://opencollective.com/readline/sponsor/0/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/0/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/1/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/1/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/2/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/2/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/3/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/3/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/4/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/4/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/5/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/5/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/6/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/6/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/7/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/7/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/8/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/8/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/9/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/9/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/10/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/10/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/11/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/11/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/12/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/12/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/13/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/13/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/14/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/14/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/15/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/15/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/16/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/16/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/17/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/17/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/18/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/18/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/19/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/19/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/20/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/20/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/21/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/21/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/22/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/22/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/23/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/23/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/24/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/24/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/25/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/25/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/26/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/26/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/27/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/27/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/28/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/28/avatar.svg"></a>
-<a href="https://opencollective.com/readline/sponsor/29/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/29/avatar.svg"></a>
-
diff --git a/vendor/github.com/chzyer/readline/ansi_windows.go b/vendor/github.com/chzyer/readline/ansi_windows.go
deleted file mode 100644
index 63b908c..0000000
--- a/vendor/github.com/chzyer/readline/ansi_windows.go
+++ /dev/null
@@ -1,249 +0,0 @@
-// +build windows
-
-package readline
-
-import (
-	"bufio"
-	"io"
-	"strconv"
-	"strings"
-	"sync"
-	"unicode/utf8"
-	"unsafe"
-)
-
-const (
-	_                = uint16(0)
-	COLOR_FBLUE      = 0x0001
-	COLOR_FGREEN     = 0x0002
-	COLOR_FRED       = 0x0004
-	COLOR_FINTENSITY = 0x0008
-
-	COLOR_BBLUE      = 0x0010
-	COLOR_BGREEN     = 0x0020
-	COLOR_BRED       = 0x0040
-	COLOR_BINTENSITY = 0x0080
-
-	COMMON_LVB_UNDERSCORE = 0x8000
-	COMMON_LVB_BOLD       = 0x0007
-)
-
-var ColorTableFg = []word{
-	0,                                       // 30: Black
-	COLOR_FRED,                              // 31: Red
-	COLOR_FGREEN,                            // 32: Green
-	COLOR_FRED | COLOR_FGREEN,               // 33: Yellow
-	COLOR_FBLUE,                             // 34: Blue
-	COLOR_FRED | COLOR_FBLUE,                // 35: Magenta
-	COLOR_FGREEN | COLOR_FBLUE,              // 36: Cyan
-	COLOR_FRED | COLOR_FBLUE | COLOR_FGREEN, // 37: White
-}
-
-var ColorTableBg = []word{
-	0,                                       // 40: Black
-	COLOR_BRED,                              // 41: Red
-	COLOR_BGREEN,                            // 42: Green
-	COLOR_BRED | COLOR_BGREEN,               // 43: Yellow
-	COLOR_BBLUE,                             // 44: Blue
-	COLOR_BRED | COLOR_BBLUE,                // 45: Magenta
-	COLOR_BGREEN | COLOR_BBLUE,              // 46: Cyan
-	COLOR_BRED | COLOR_BBLUE | COLOR_BGREEN, // 47: White
-}
-
-type ANSIWriter struct {
-	target io.Writer
-	wg     sync.WaitGroup
-	ctx    *ANSIWriterCtx
-	sync.Mutex
-}
-
-func NewANSIWriter(w io.Writer) *ANSIWriter {
-	a := &ANSIWriter{
-		target: w,
-		ctx:    NewANSIWriterCtx(w),
-	}
-	return a
-}
-
-func (a *ANSIWriter) Close() error {
-	a.wg.Wait()
-	return nil
-}
-
-type ANSIWriterCtx struct {
-	isEsc     bool
-	isEscSeq  bool
-	arg       []string
-	target    *bufio.Writer
-	wantFlush bool
-}
-
-func NewANSIWriterCtx(target io.Writer) *ANSIWriterCtx {
-	return &ANSIWriterCtx{
-		target: bufio.NewWriter(target),
-	}
-}
-
-func (a *ANSIWriterCtx) Flush() {
-	a.target.Flush()
-}
-
-func (a *ANSIWriterCtx) process(r rune) bool {
-	if a.wantFlush {
-		if r == 0 || r == CharEsc {
-			a.wantFlush = false
-			a.target.Flush()
-		}
-	}
-	if a.isEscSeq {
-		a.isEscSeq = a.ioloopEscSeq(a.target, r, &a.arg)
-		return true
-	}
-
-	switch r {
-	case CharEsc:
-		a.isEsc = true
-	case '[':
-		if a.isEsc {
-			a.arg = nil
-			a.isEscSeq = true
-			a.isEsc = false
-			break
-		}
-		fallthrough
-	default:
-		a.target.WriteRune(r)
-		a.wantFlush = true
-	}
-	return true
-}
-
-func (a *ANSIWriterCtx) ioloopEscSeq(w *bufio.Writer, r rune, argptr *[]string) bool {
-	arg := *argptr
-	var err error
-
-	if r >= 'A' && r <= 'D' {
-		count := short(GetInt(arg, 1))
-		info, err := GetConsoleScreenBufferInfo()
-		if err != nil {
-			return false
-		}
-		switch r {
-		case 'A': // up
-			info.dwCursorPosition.y -= count
-		case 'B': // down
-			info.dwCursorPosition.y += count
-		case 'C': // right
-			info.dwCursorPosition.x += count
-		case 'D': // left
-			info.dwCursorPosition.x -= count
-		}
-		SetConsoleCursorPosition(&info.dwCursorPosition)
-		return false
-	}
-
-	switch r {
-	case 'J':
-		killLines()
-	case 'K':
-		eraseLine()
-	case 'm':
-		color := word(0)
-		for _, item := range arg {
-			var c int
-			c, err = strconv.Atoi(item)
-			if err != nil {
-				w.WriteString("[" + strings.Join(arg, ";") + "m")
-				break
-			}
-			if c >= 30 && c < 40 {
-				color ^= COLOR_FINTENSITY
-				color |= ColorTableFg[c-30]
-			} else if c >= 40 && c < 50 {
-				color ^= COLOR_BINTENSITY
-				color |= ColorTableBg[c-40]
-			} else if c == 4 {
-				color |= COMMON_LVB_UNDERSCORE | ColorTableFg[7]
-			} else if c == 1 {
-				color |= COMMON_LVB_BOLD | COLOR_FINTENSITY
-			} else { // unknown code treat as reset
-				color = ColorTableFg[7]
-			}
-		}
-		if err != nil {
-			break
-		}
-		kernel.SetConsoleTextAttribute(stdout, uintptr(color))
-	case '\007': // set title
-	case ';':
-		if len(arg) == 0 || arg[len(arg)-1] != "" {
-			arg = append(arg, "")
-			*argptr = arg
-		}
-		return true
-	default:
-		if len(arg) == 0 {
-			arg = append(arg, "")
-		}
-		arg[len(arg)-1] += string(r)
-		*argptr = arg
-		return true
-	}
-	*argptr = nil
-	return false
-}
-
-func (a *ANSIWriter) Write(b []byte) (int, error) {
-	a.Lock()
-	defer a.Unlock()
-
-	off := 0
-	for len(b) > off {
-		r, size := utf8.DecodeRune(b[off:])
-		if size == 0 {
-			return off, io.ErrShortWrite
-		}
-		off += size
-		a.ctx.process(r)
-	}
-	a.ctx.Flush()
-	return off, nil
-}
-
-func killLines() error {
-	sbi, err := GetConsoleScreenBufferInfo()
-	if err != nil {
-		return err
-	}
-
-	size := (sbi.dwCursorPosition.y - sbi.dwSize.y) * sbi.dwSize.x
-	size += sbi.dwCursorPosition.x
-
-	var written int
-	kernel.FillConsoleOutputAttribute(stdout, uintptr(ColorTableFg[7]),
-		uintptr(size),
-		sbi.dwCursorPosition.ptr(),
-		uintptr(unsafe.Pointer(&written)),
-	)
-	return kernel.FillConsoleOutputCharacterW(stdout, uintptr(' '),
-		uintptr(size),
-		sbi.dwCursorPosition.ptr(),
-		uintptr(unsafe.Pointer(&written)),
-	)
-}
-
-func eraseLine() error {
-	sbi, err := GetConsoleScreenBufferInfo()
-	if err != nil {
-		return err
-	}
-
-	size := sbi.dwSize.x
-	sbi.dwCursorPosition.x = 0
-	var written int
-	return kernel.FillConsoleOutputCharacterW(stdout, uintptr(' '),
-		uintptr(size),
-		sbi.dwCursorPosition.ptr(),
-		uintptr(unsafe.Pointer(&written)),
-	)
-}
diff --git a/vendor/github.com/chzyer/readline/complete.go b/vendor/github.com/chzyer/readline/complete.go
deleted file mode 100644
index 9e27ce3..0000000
--- a/vendor/github.com/chzyer/readline/complete.go
+++ /dev/null
@@ -1,314 +0,0 @@
-package readline
-
-import (
-	"bufio"
-	"bytes"
-	"fmt"
-	"io"
-)
-
-type AutoCompleter interface {
-	// Readline will pass the whole line and current offset to it
-	// Completer need to pass all the candidates, and how long they shared the same characters in line
-	// Example:
-	//   [go, git, git-shell, grep]
-	//   Do("g", 1) => ["o", "it", "it-shell", "rep"], 1
-	//   Do("gi", 2) => ["t", "t-shell"], 2
-	//   Do("git", 3) => ["", "-shell"], 3
-	Do(line []rune, pos int) (newLine [][]rune, length int)
-}
-
-type TabCompleter struct{}
-
-func (t *TabCompleter) Do([]rune, int) ([][]rune, int) {
-	return [][]rune{[]rune("\t")}, 0
-}
-
-type opCompleter struct {
-	w     io.Writer
-	op    *Operation
-	width int
-
-	inCompleteMode  bool
-	inSelectMode    bool
-	candidate       [][]rune
-	candidateSource []rune
-	candidateOff    int
-	candidateChoise int
-	candidateColNum int
-}
-
-func newOpCompleter(w io.Writer, op *Operation, width int) *opCompleter {
-	return &opCompleter{
-		w:     w,
-		op:    op,
-		width: width,
-	}
-}
-
-func (o *opCompleter) truncateBufferAfterLastEqual(completion []rune) {
-	bufRunes := o.op.buf.Runes()
-	for i := len(bufRunes) - 1; i >= 0; i-- {
-		if bufRunes[i] == '=' {
-			prefix := bufRunes[i+1:] // part after '=' in buffer
-			if len(prefix) > 0 && len(completion) > len(prefix) && string(completion[:len(prefix)]) == string(prefix) {
-				o.op.buf.Set(bufRunes[:i+1]) // Keep content till '='
-			}
-			break
-		}
-	}
-}
-
-func (o *opCompleter) writeRunes(candidate []rune) {
-	selected := candidate
-	spaceFound := false
-	for idx, r := range candidate {
-		if r == ' ' {
-			spaceFound = true
-		}
-		if spaceFound && r == '(' {
-			o.truncateBufferAfterLastEqual(candidate[idx+1:])
-			selected = candidate[:idx]
-			break
-		}
-	}
-	o.op.buf.WriteRunes(selected)
-}
-
-func (o *opCompleter) doSelect() {
-	if len(o.candidate) == 1 {
-		o.writeRunes(o.candidate[0])
-		o.ExitCompleteMode(false)
-		return
-	}
-	o.nextCandidate(1)
-	o.CompleteRefresh()
-}
-
-func (o *opCompleter) nextCandidate(i int) {
-	o.candidateChoise += i
-	o.candidateChoise = o.candidateChoise % len(o.candidate)
-	if o.candidateChoise < 0 {
-		o.candidateChoise = len(o.candidate) + o.candidateChoise
-	}
-}
-
-func (o *opCompleter) OnComplete() bool {
-	if o.width == 0 {
-		return false
-	}
-	if o.IsInCompleteSelectMode() {
-		o.doSelect()
-		return true
-	}
-
-	buf := o.op.buf
-	rs := buf.Runes()
-
-	if o.IsInCompleteMode() && o.candidateSource != nil && runes.Equal(rs, o.candidateSource) {
-		o.EnterCompleteSelectMode()
-		o.doSelect()
-		return true
-	}
-
-	o.ExitCompleteSelectMode()
-	o.candidateSource = rs
-	newLines, offset := o.op.cfg.AutoComplete.Do(rs, buf.idx)
-	if len(newLines) == 0 {
-		o.ExitCompleteMode(false)
-		return true
-	}
-
-	// only Aggregate candidates in non-complete mode
-	if !o.IsInCompleteMode() {
-		if len(newLines) == 1 {
-			o.writeRunes(newLines[0])
-			o.ExitCompleteMode(false)
-			return true
-		}
-
-		same, size := runes.Aggregate(newLines)
-		if size > 0 {
-			buf.WriteRunes(same)
-			o.ExitCompleteMode(false)
-			return true
-		}
-	}
-
-	o.EnterCompleteMode(offset, newLines)
-	return true
-}
-
-func (o *opCompleter) IsInCompleteSelectMode() bool {
-	return o.inSelectMode
-}
-
-func (o *opCompleter) IsInCompleteMode() bool {
-	return o.inCompleteMode
-}
-
-func (o *opCompleter) HandleCompleteSelect(r rune) bool {
-	next := true
-	switch r {
-	case CharEnter, CharCtrlJ:
-		next = false
-		o.writeRunes(o.op.candidate[o.op.candidateChoise])
-		o.ExitCompleteMode(false)
-	case CharLineStart:
-		num := o.candidateChoise % o.candidateColNum
-		o.nextCandidate(-num)
-	case CharLineEnd:
-		num := o.candidateColNum - o.candidateChoise%o.candidateColNum - 1
-		o.candidateChoise += num
-		if o.candidateChoise >= len(o.candidate) {
-			o.candidateChoise = len(o.candidate) - 1
-		}
-	case CharBackspace:
-		o.ExitCompleteSelectMode()
-		next = false
-	case CharTab, CharForward:
-		o.doSelect()
-	case CharBell, CharInterrupt:
-		o.ExitCompleteMode(true)
-		next = false
-	case CharNext:
-		tmpChoise := o.candidateChoise + o.candidateColNum
-		if tmpChoise >= o.getMatrixSize() {
-			tmpChoise -= o.getMatrixSize()
-		} else if tmpChoise >= len(o.candidate) {
-			tmpChoise += o.candidateColNum
-			tmpChoise -= o.getMatrixSize()
-		}
-		o.candidateChoise = tmpChoise
-	case CharBackward:
-		o.nextCandidate(-1)
-	case CharPrev:
-		tmpChoise := o.candidateChoise - o.candidateColNum
-		if tmpChoise < 0 {
-			tmpChoise += o.getMatrixSize()
-			if tmpChoise >= len(o.candidate) {
-				tmpChoise -= o.candidateColNum
-			}
-		}
-		o.candidateChoise = tmpChoise
-	default:
-		next = false
-		o.ExitCompleteSelectMode()
-	}
-	if next {
-		o.CompleteRefresh()
-		return true
-	}
-	return false
-}
-
-func (o *opCompleter) getMatrixSize() int {
-	line := len(o.candidate) / o.candidateColNum
-	if len(o.candidate)%o.candidateColNum != 0 {
-		line++
-	}
-	return line * o.candidateColNum
-}
-
-func (o *opCompleter) OnWidthChange(newWidth int) {
-	o.width = newWidth
-}
-
-func (o *opCompleter) CompleteRefresh() {
-	if !o.inCompleteMode {
-		return
-	}
-	lineCnt := o.op.buf.CursorLineCount()
-	colWidth := 0
-	for _, c := range o.candidate {
-		w := runes.WidthAll(c)
-		if w > colWidth {
-			colWidth = w
-		}
-	}
-	colWidth += o.candidateOff + 1
-	same := o.op.buf.RuneSlice(-o.candidateOff)
-
-	// -1 to avoid reach the end of line
-	width := o.width - 1
-	colNum := width / colWidth
-	if colNum != 0 {
-		colWidth += (width - (colWidth * colNum)) / colNum
-	}
-
-	o.candidateColNum = colNum
-	buf := bufio.NewWriter(o.w)
-	buf.Write(bytes.Repeat([]byte("\n"), lineCnt))
-
-	colIdx := 0
-	lines := 1
-	buf.WriteString("\033[J")
-	for idx, c := range o.candidate {
-		inSelect := idx == o.candidateChoise && o.IsInCompleteSelectMode()
-		if inSelect {
-			buf.WriteString("\033[30;47m")
-		}
-		buf.WriteString(string(same))
-		buf.WriteString(string(c))
-		buf.Write(bytes.Repeat([]byte(" "), colWidth-runes.WidthAll(c)-runes.WidthAll(same)))
-
-		if inSelect {
-			buf.WriteString("\033[0m")
-		}
-
-		colIdx++
-		if colIdx == colNum {
-			buf.WriteString("\n")
-			lines++
-			colIdx = 0
-		}
-	}
-
-	// move back
-	fmt.Fprintf(buf, "\033[%dA\r", lineCnt-1+lines)
-	fmt.Fprintf(buf, "\033[%dC", o.op.buf.idx+o.op.buf.PromptLen())
-	buf.Flush()
-}
-
-func (o *opCompleter) aggCandidate(candidate [][]rune) int {
-	offset := 0
-	for i := 0; i < len(candidate[0]); i++ {
-		for j := 0; j < len(candidate)-1; j++ {
-			if i > len(candidate[j]) {
-				goto aggregate
-			}
-			if candidate[j][i] != candidate[j+1][i] {
-				goto aggregate
-			}
-		}
-		offset = i
-	}
-aggregate:
-	return offset
-}
-
-func (o *opCompleter) EnterCompleteSelectMode() {
-	o.inSelectMode = true
-	o.candidateChoise = -1
-	o.CompleteRefresh()
-}
-
-func (o *opCompleter) EnterCompleteMode(offset int, candidate [][]rune) {
-	o.inCompleteMode = true
-	o.candidate = candidate
-	o.candidateOff = offset
-	o.CompleteRefresh()
-}
-
-func (o *opCompleter) ExitCompleteSelectMode() {
-	o.inSelectMode = false
-	o.candidate = nil
-	o.candidateChoise = -1
-	o.candidateOff = -1
-	o.candidateSource = nil
-}
-
-func (o *opCompleter) ExitCompleteMode(revent bool) {
-	o.inCompleteMode = false
-	o.ExitCompleteSelectMode()
-}
diff --git a/vendor/github.com/chzyer/readline/complete_helper.go b/vendor/github.com/chzyer/readline/complete_helper.go
deleted file mode 100644
index 58d7248..0000000
--- a/vendor/github.com/chzyer/readline/complete_helper.go
+++ /dev/null
@@ -1,165 +0,0 @@
-package readline
-
-import (
-	"bytes"
-	"strings"
-)
-
-// Caller type for dynamic completion
-type DynamicCompleteFunc func(string) []string
-
-type PrefixCompleterInterface interface {
-	Print(prefix string, level int, buf *bytes.Buffer)
-	Do(line []rune, pos int) (newLine [][]rune, length int)
-	GetName() []rune
-	GetChildren() []PrefixCompleterInterface
-	SetChildren(children []PrefixCompleterInterface)
-}
-
-type DynamicPrefixCompleterInterface interface {
-	PrefixCompleterInterface
-	IsDynamic() bool
-	GetDynamicNames(line []rune) [][]rune
-}
-
-type PrefixCompleter struct {
-	Name     []rune
-	Dynamic  bool
-	Callback DynamicCompleteFunc
-	Children []PrefixCompleterInterface
-}
-
-func (p *PrefixCompleter) Tree(prefix string) string {
-	buf := bytes.NewBuffer(nil)
-	p.Print(prefix, 0, buf)
-	return buf.String()
-}
-
-func Print(p PrefixCompleterInterface, prefix string, level int, buf *bytes.Buffer) {
-	if strings.TrimSpace(string(p.GetName())) != "" {
-		buf.WriteString(prefix)
-		if level > 0 {
-			buf.WriteString("├")
-			buf.WriteString(strings.Repeat("─", (level*4)-2))
-			buf.WriteString(" ")
-		}
-		buf.WriteString(string(p.GetName()) + "\n")
-		level++
-	}
-	for _, ch := range p.GetChildren() {
-		ch.Print(prefix, level, buf)
-	}
-}
-
-func (p *PrefixCompleter) Print(prefix string, level int, buf *bytes.Buffer) {
-	Print(p, prefix, level, buf)
-}
-
-func (p *PrefixCompleter) IsDynamic() bool {
-	return p.Dynamic
-}
-
-func (p *PrefixCompleter) GetName() []rune {
-	return p.Name
-}
-
-func (p *PrefixCompleter) GetDynamicNames(line []rune) [][]rune {
-	var names = [][]rune{}
-	for _, name := range p.Callback(string(line)) {
-		names = append(names, []rune(name+" "))
-	}
-	return names
-}
-
-func (p *PrefixCompleter) GetChildren() []PrefixCompleterInterface {
-	return p.Children
-}
-
-func (p *PrefixCompleter) SetChildren(children []PrefixCompleterInterface) {
-	p.Children = children
-}
-
-func NewPrefixCompleter(pc ...PrefixCompleterInterface) *PrefixCompleter {
-	return PcItem("", pc...)
-}
-
-func PcItem(name string, pc ...PrefixCompleterInterface) *PrefixCompleter {
-	name += " "
-	return &PrefixCompleter{
-		Name:     []rune(name),
-		Dynamic:  false,
-		Children: pc,
-	}
-}
-
-func PcItemDynamic(callback DynamicCompleteFunc, pc ...PrefixCompleterInterface) *PrefixCompleter {
-	return &PrefixCompleter{
-		Callback: callback,
-		Dynamic:  true,
-		Children: pc,
-	}
-}
-
-func (p *PrefixCompleter) Do(line []rune, pos int) (newLine [][]rune, offset int) {
-	return doInternal(p, line, pos, line)
-}
-
-func Do(p PrefixCompleterInterface, line []rune, pos int) (newLine [][]rune, offset int) {
-	return doInternal(p, line, pos, line)
-}
-
-func doInternal(p PrefixCompleterInterface, line []rune, pos int, origLine []rune) (newLine [][]rune, offset int) {
-	line = runes.TrimSpaceLeft(line[:pos])
-	goNext := false
-	var lineCompleter PrefixCompleterInterface
-	for _, child := range p.GetChildren() {
-		childNames := make([][]rune, 1)
-
-		childDynamic, ok := child.(DynamicPrefixCompleterInterface)
-		if ok && childDynamic.IsDynamic() {
-			childNames = childDynamic.GetDynamicNames(origLine)
-		} else {
-			childNames[0] = child.GetName()
-		}
-
-		for _, childName := range childNames {
-			if len(line) >= len(childName) {
-				if runes.HasPrefix(line, childName) {
-					if len(line) == len(childName) {
-						newLine = append(newLine, []rune{' '})
-					} else {
-						newLine = append(newLine, childName)
-					}
-					offset = len(childName)
-					lineCompleter = child
-					goNext = true
-				}
-			} else {
-				if runes.HasPrefix(childName, line) {
-					newLine = append(newLine, childName[len(line):])
-					offset = len(line)
-					lineCompleter = child
-				}
-			}
-		}
-	}
-
-	if len(newLine) != 1 {
-		return
-	}
-
-	tmpLine := make([]rune, 0, len(line))
-	for i := offset; i < len(line); i++ {
-		if line[i] == ' ' {
-			continue
-		}
-
-		tmpLine = append(tmpLine, line[i:]...)
-		return doInternal(lineCompleter, tmpLine, len(tmpLine), origLine)
-	}
-
-	if goNext {
-		return doInternal(lineCompleter, nil, 0, origLine)
-	}
-	return
-}
diff --git a/vendor/github.com/chzyer/readline/complete_segment.go b/vendor/github.com/chzyer/readline/complete_segment.go
deleted file mode 100644
index 5ceadd8..0000000
--- a/vendor/github.com/chzyer/readline/complete_segment.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package readline
-
-type SegmentCompleter interface {
-	// a
-	// |- a1
-	// |--- a11
-	// |- a2
-	// b
-	// input:
-	//   DoTree([], 0) [a, b]
-	//   DoTree([a], 1) [a]
-	//   DoTree([a, ], 0) [a1, a2]
-	//   DoTree([a, a], 1) [a1, a2]
-	//   DoTree([a, a1], 2) [a1]
-	//   DoTree([a, a1, ], 0) [a11]
-	//   DoTree([a, a1, a], 1) [a11]
-	DoSegment([][]rune, int) [][]rune
-}
-
-type dumpSegmentCompleter struct {
-	f func([][]rune, int) [][]rune
-}
-
-func (d *dumpSegmentCompleter) DoSegment(segment [][]rune, n int) [][]rune {
-	return d.f(segment, n)
-}
-
-func SegmentFunc(f func([][]rune, int) [][]rune) AutoCompleter {
-	return &SegmentComplete{&dumpSegmentCompleter{f}}
-}
-
-func SegmentAutoComplete(completer SegmentCompleter) *SegmentComplete {
-	return &SegmentComplete{
-		SegmentCompleter: completer,
-	}
-}
-
-type SegmentComplete struct {
-	SegmentCompleter
-}
-
-func RetSegment(segments [][]rune, cands [][]rune, idx int) ([][]rune, int) {
-	ret := make([][]rune, 0, len(cands))
-	lastSegment := segments[len(segments)-1]
-	for _, cand := range cands {
-		if !runes.HasPrefix(cand, lastSegment) {
-			continue
-		}
-		ret = append(ret, cand[len(lastSegment):])
-	}
-	return ret, idx
-}
-
-func SplitSegment(line []rune, pos int) ([][]rune, int) {
-	segs := [][]rune{}
-	lastIdx := -1
-	line = line[:pos]
-	pos = 0
-	for idx, l := range line {
-		if l == ' ' {
-			pos = 0
-			segs = append(segs, line[lastIdx+1:idx])
-			lastIdx = idx
-		} else {
-			pos++
-		}
-	}
-	segs = append(segs, line[lastIdx+1:])
-	return segs, pos
-}
-
-func (c *SegmentComplete) Do(line []rune, pos int) (newLine [][]rune, offset int) {
-
-	segment, idx := SplitSegment(line, pos)
-
-	cands := c.DoSegment(segment, idx)
-	newLine, offset = RetSegment(segment, cands, idx)
-	for idx := range newLine {
-		newLine[idx] = append(newLine[idx], ' ')
-	}
-	return newLine, offset
-}
diff --git a/vendor/github.com/chzyer/readline/operation.go b/vendor/github.com/chzyer/readline/operation.go
deleted file mode 100644
index b60939a..0000000
--- a/vendor/github.com/chzyer/readline/operation.go
+++ /dev/null
@@ -1,537 +0,0 @@
-package readline
-
-import (
-	"errors"
-	"io"
-	"sync"
-)
-
-var (
-	ErrInterrupt = errors.New("Interrupt")
-)
-
-type InterruptError struct {
-	Line []rune
-}
-
-func (*InterruptError) Error() string {
-	return "Interrupted"
-}
-
-type Operation struct {
-	m       sync.Mutex
-	cfg     *Config
-	t       *Terminal
-	buf     *RuneBuffer
-	outchan chan []rune
-	errchan chan error
-	w       io.Writer
-
-	history *opHistory
-	*opSearch
-	*opCompleter
-	*opPassword
-	*opVim
-}
-
-func (o *Operation) SetBuffer(what string) {
-	o.buf.Set([]rune(what))
-}
-
-type wrapWriter struct {
-	r      *Operation
-	t      *Terminal
-	target io.Writer
-}
-
-func (w *wrapWriter) Write(b []byte) (int, error) {
-	if !w.t.IsReading() {
-		return w.target.Write(b)
-	}
-
-	var (
-		n   int
-		err error
-	)
-	w.r.buf.Refresh(func() {
-		n, err = w.target.Write(b)
-	})
-
-	if w.r.IsSearchMode() {
-		w.r.SearchRefresh(-1)
-	}
-	if w.r.IsInCompleteMode() {
-		w.r.CompleteRefresh()
-	}
-	return n, err
-}
-
-func NewOperation(t *Terminal, cfg *Config) *Operation {
-	width := cfg.FuncGetWidth()
-	op := &Operation{
-		t:       t,
-		buf:     NewRuneBuffer(t, cfg.Prompt, cfg, width),
-		outchan: make(chan []rune),
-		errchan: make(chan error, 1),
-	}
-	op.w = op.buf.w
-	op.SetConfig(cfg)
-	op.opVim = newVimMode(op)
-	op.opCompleter = newOpCompleter(op.buf.w, op, width)
-	op.opPassword = newOpPassword(op)
-	op.cfg.FuncOnWidthChanged(func() {
-		newWidth := cfg.FuncGetWidth()
-		op.opCompleter.OnWidthChange(newWidth)
-		op.opSearch.OnWidthChange(newWidth)
-		op.buf.OnWidthChange(newWidth)
-	})
-	go op.ioloop()
-	return op
-}
-
-func (o *Operation) SetPrompt(s string) {
-	o.buf.SetPrompt(s)
-}
-
-func (o *Operation) SetMaskRune(r rune) {
-	o.buf.SetMask(r)
-}
-
-func (o *Operation) GetConfig() *Config {
-	o.m.Lock()
-	cfg := *o.cfg
-	o.m.Unlock()
-	return &cfg
-}
-
-func (o *Operation) ioloop() {
-	for {
-		keepInSearchMode := false
-		keepInCompleteMode := false
-		r := o.t.ReadRune()
-
-		if o.GetConfig().FuncFilterInputRune != nil {
-			var process bool
-			r, process = o.GetConfig().FuncFilterInputRune(r)
-			if !process {
-				o.t.KickRead()
-				o.buf.Refresh(nil) // to refresh the line
-				continue           // ignore this rune
-			}
-		}
-
-		if r == 0 { // io.EOF
-			if o.buf.Len() == 0 {
-				o.buf.Clean()
-				select {
-				case o.errchan <- io.EOF:
-				}
-				break
-			} else {
-				// if stdin got io.EOF and there is something left in buffer,
-				// let's flush them by sending CharEnter.
-				// And we will got io.EOF int next loop.
-				r = CharEnter
-			}
-		}
-		isUpdateHistory := true
-
-		if o.IsInCompleteSelectMode() {
-			keepInCompleteMode = o.HandleCompleteSelect(r)
-			if keepInCompleteMode {
-				continue
-			}
-
-			o.buf.Refresh(nil)
-			switch r {
-			case CharEnter, CharCtrlJ:
-				o.history.Update(o.buf.Runes(), false)
-				fallthrough
-			case CharInterrupt:
-				o.t.KickRead()
-				fallthrough
-			case CharBell:
-				continue
-			}
-		}
-
-		if o.IsEnableVimMode() {
-			r = o.HandleVim(r, o.t.ReadRune)
-			if r == 0 {
-				continue
-			}
-		}
-
-		switch r {
-		case CharBell:
-			if o.IsSearchMode() {
-				o.ExitSearchMode(true)
-				o.buf.Refresh(nil)
-			}
-			if o.IsInCompleteMode() {
-				o.ExitCompleteMode(true)
-				o.buf.Refresh(nil)
-			}
-		case CharTab:
-			if o.GetConfig().AutoComplete == nil {
-				o.t.Bell()
-				break
-			}
-			if o.OnComplete() {
-				keepInCompleteMode = true
-			} else {
-				o.t.Bell()
-				break
-			}
-
-		case CharBckSearch:
-			if !o.SearchMode(S_DIR_BCK) {
-				o.t.Bell()
-				break
-			}
-			keepInSearchMode = true
-		case CharCtrlU:
-			o.buf.KillFront()
-		case CharFwdSearch:
-			if !o.SearchMode(S_DIR_FWD) {
-				o.t.Bell()
-				break
-			}
-			keepInSearchMode = true
-		case CharKill:
-			o.buf.Kill()
-			keepInCompleteMode = true
-		case MetaForward:
-			o.buf.MoveToNextWord()
-		case CharTranspose:
-			o.buf.Transpose()
-		case MetaBackward:
-			o.buf.MoveToPrevWord()
-		case MetaDelete:
-			o.buf.DeleteWord()
-		case CharLineStart:
-			o.buf.MoveToLineStart()
-		case CharLineEnd:
-			o.buf.MoveToLineEnd()
-		case CharBackspace, CharCtrlH:
-			if o.IsSearchMode() {
-				o.SearchBackspace()
-				keepInSearchMode = true
-				break
-			}
-
-			if o.buf.Len() == 0 {
-				o.t.Bell()
-				break
-			}
-			o.buf.Backspace()
-			if o.IsInCompleteMode() {
-				o.OnComplete()
-			}
-		case CharCtrlZ:
-			o.buf.Clean()
-			o.t.SleepToResume()
-			o.Refresh()
-		case CharCtrlL:
-			ClearScreen(o.w)
-			o.Refresh()
-		case MetaBackspace, CharCtrlW:
-			o.buf.BackEscapeWord()
-		case CharCtrlY:
-			o.buf.Yank()
-		case CharEnter, CharCtrlJ:
-			if o.IsSearchMode() {
-				o.ExitSearchMode(false)
-			}
-			o.buf.MoveToLineEnd()
-			var data []rune
-			if !o.GetConfig().UniqueEditLine {
-				o.buf.WriteRune('\n')
-				data = o.buf.Reset()
-				data = data[:len(data)-1] // trim \n
-			} else {
-				o.buf.Clean()
-				data = o.buf.Reset()
-			}
-			o.outchan <- data
-			if !o.GetConfig().DisableAutoSaveHistory {
-				// ignore IO error
-				_ = o.history.New(data)
-			} else {
-				isUpdateHistory = false
-			}
-		case CharBackward:
-			o.buf.MoveBackward()
-		case CharForward:
-			o.buf.MoveForward()
-		case CharPrev:
-			buf := o.history.Prev()
-			if buf != nil {
-				o.buf.Set(buf)
-			} else {
-				o.t.Bell()
-			}
-		case CharNext:
-			buf, ok := o.history.Next()
-			if ok {
-				o.buf.Set(buf)
-			} else {
-				o.t.Bell()
-			}
-		case CharDelete:
-			if o.buf.Len() > 0 || !o.IsNormalMode() {
-				o.t.KickRead()
-				if !o.buf.Delete() {
-					o.t.Bell()
-				}
-				break
-			}
-
-			// treat as EOF
-			if !o.GetConfig().UniqueEditLine {
-				o.buf.WriteString(o.GetConfig().EOFPrompt + "\n")
-			}
-			o.buf.Reset()
-			isUpdateHistory = false
-			o.history.Revert()
-			o.errchan <- io.EOF
-			if o.GetConfig().UniqueEditLine {
-				o.buf.Clean()
-			}
-		case CharInterrupt:
-			if o.IsSearchMode() {
-				o.t.KickRead()
-				o.ExitSearchMode(true)
-				break
-			}
-			if o.IsInCompleteMode() {
-				o.t.KickRead()
-				o.ExitCompleteMode(true)
-				o.buf.Refresh(nil)
-				break
-			}
-			o.buf.MoveToLineEnd()
-			o.buf.Refresh(nil)
-			hint := o.GetConfig().InterruptPrompt + "\n"
-			if !o.GetConfig().UniqueEditLine {
-				o.buf.WriteString(hint)
-			}
-			remain := o.buf.Reset()
-			if !o.GetConfig().UniqueEditLine {
-				remain = remain[:len(remain)-len([]rune(hint))]
-			}
-			isUpdateHistory = false
-			o.history.Revert()
-			o.errchan <- &InterruptError{remain}
-		default:
-			if o.IsSearchMode() {
-				o.SearchChar(r)
-				keepInSearchMode = true
-				break
-			}
-			o.buf.WriteRune(r)
-			if o.IsInCompleteMode() {
-				o.OnComplete()
-				keepInCompleteMode = true
-			}
-		}
-
-		listener := o.GetConfig().Listener
-		if listener != nil {
-			newLine, newPos, ok := listener.OnChange(o.buf.Runes(), o.buf.Pos(), r)
-			if ok {
-				o.buf.SetWithIdx(newPos, newLine)
-			}
-		}
-
-		o.m.Lock()
-		if !keepInSearchMode && o.IsSearchMode() {
-			o.ExitSearchMode(false)
-			o.buf.Refresh(nil)
-		} else if o.IsInCompleteMode() {
-			if !keepInCompleteMode {
-				o.ExitCompleteMode(false)
-				o.Refresh()
-			} else {
-				o.buf.Refresh(nil)
-				o.CompleteRefresh()
-			}
-		}
-		if isUpdateHistory && !o.IsSearchMode() {
-			// it will cause null history
-			o.history.Update(o.buf.Runes(), false)
-		}
-		o.m.Unlock()
-	}
-}
-
-func (o *Operation) Stderr() io.Writer {
-	return &wrapWriter{target: o.GetConfig().Stderr, r: o, t: o.t}
-}
-
-func (o *Operation) Stdout() io.Writer {
-	return &wrapWriter{target: o.GetConfig().Stdout, r: o, t: o.t}
-}
-
-func (o *Operation) String() (string, error) {
-	r, err := o.Runes()
-	return string(r), err
-}
-
-func (o *Operation) Runes() ([]rune, error) {
-	o.t.EnterRawMode()
-	defer o.t.ExitRawMode()
-
-	listener := o.GetConfig().Listener
-	if listener != nil {
-		listener.OnChange(nil, 0, 0)
-	}
-
-	o.buf.Refresh(nil) // print prompt
-	o.t.KickRead()
-	select {
-	case r := <-o.outchan:
-		return r, nil
-	case err := <-o.errchan:
-		if e, ok := err.(*InterruptError); ok {
-			return e.Line, ErrInterrupt
-		}
-		return nil, err
-	}
-}
-
-func (o *Operation) PasswordEx(prompt string, l Listener) ([]byte, error) {
-	cfg := o.GenPasswordConfig()
-	cfg.Prompt = prompt
-	cfg.Listener = l
-	return o.PasswordWithConfig(cfg)
-}
-
-func (o *Operation) GenPasswordConfig() *Config {
-	return o.opPassword.PasswordConfig()
-}
-
-func (o *Operation) PasswordWithConfig(cfg *Config) ([]byte, error) {
-	if err := o.opPassword.EnterPasswordMode(cfg); err != nil {
-		return nil, err
-	}
-	defer o.opPassword.ExitPasswordMode()
-	return o.Slice()
-}
-
-func (o *Operation) Password(prompt string) ([]byte, error) {
-	return o.PasswordEx(prompt, nil)
-}
-
-func (o *Operation) SetTitle(t string) {
-	o.w.Write([]byte("\033[2;" + t + "\007"))
-}
-
-func (o *Operation) Slice() ([]byte, error) {
-	r, err := o.Runes()
-	if err != nil {
-		return nil, err
-	}
-	return []byte(string(r)), nil
-}
-
-func (o *Operation) Close() {
-	select {
-	case o.errchan <- io.EOF:
-	default:
-	}
-	o.history.Close()
-}
-
-func (o *Operation) SetHistoryPath(path string) {
-	if o.history != nil {
-		o.history.Close()
-	}
-	o.cfg.HistoryFile = path
-	o.history = newOpHistory(o.cfg)
-}
-
-func (o *Operation) IsNormalMode() bool {
-	return !o.IsInCompleteMode() && !o.IsSearchMode()
-}
-
-func (op *Operation) SetConfig(cfg *Config) (*Config, error) {
-	op.m.Lock()
-	defer op.m.Unlock()
-	if op.cfg == cfg {
-		return op.cfg, nil
-	}
-	if err := cfg.Init(); err != nil {
-		return op.cfg, err
-	}
-	old := op.cfg
-	op.cfg = cfg
-	op.SetPrompt(cfg.Prompt)
-	op.SetMaskRune(cfg.MaskRune)
-	op.buf.SetConfig(cfg)
-	width := op.cfg.FuncGetWidth()
-
-	if cfg.opHistory == nil {
-		op.SetHistoryPath(cfg.HistoryFile)
-		cfg.opHistory = op.history
-		cfg.opSearch = newOpSearch(op.buf.w, op.buf, op.history, cfg, width)
-	}
-	op.history = cfg.opHistory
-
-	// SetHistoryPath will close opHistory which already exists
-	// so if we use it next time, we need to reopen it by `InitHistory()`
-	op.history.Init()
-
-	if op.cfg.AutoComplete != nil {
-		op.opCompleter = newOpCompleter(op.buf.w, op, width)
-	}
-
-	op.opSearch = cfg.opSearch
-	return old, nil
-}
-
-func (o *Operation) ResetHistory() {
-	o.history.Reset()
-}
-
-// if err is not nil, it just mean it fail to write to file
-// other things goes fine.
-func (o *Operation) SaveHistory(content string) error {
-	return o.history.New([]rune(content))
-}
-
-func (o *Operation) Refresh() {
-	if o.t.IsReading() {
-		o.buf.Refresh(nil)
-	}
-}
-
-func (o *Operation) Clean() {
-	o.buf.Clean()
-}
-
-func FuncListener(f func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)) Listener {
-	return &DumpListener{f: f}
-}
-
-type DumpListener struct {
-	f func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)
-}
-
-func (d *DumpListener) OnChange(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool) {
-	return d.f(line, pos, key)
-}
-
-type Listener interface {
-	OnChange(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)
-}
-
-type Painter interface {
-	Paint(line []rune, pos int) []rune
-}
-
-type defaultPainter struct{}
-
-func (p *defaultPainter) Paint(line []rune, _ int) []rune {
-	return line
-}
diff --git a/vendor/github.com/chzyer/readline/password.go b/vendor/github.com/chzyer/readline/password.go
deleted file mode 100644
index 414288c..0000000
--- a/vendor/github.com/chzyer/readline/password.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package readline
-
-type opPassword struct {
-	o         *Operation
-	backupCfg *Config
-}
-
-func newOpPassword(o *Operation) *opPassword {
-	return &opPassword{o: o}
-}
-
-func (o *opPassword) ExitPasswordMode() {
-	o.o.SetConfig(o.backupCfg)
-	o.backupCfg = nil
-}
-
-func (o *opPassword) EnterPasswordMode(cfg *Config) (err error) {
-	o.backupCfg, err = o.o.SetConfig(cfg)
-	return
-}
-
-func (o *opPassword) PasswordConfig() *Config {
-	return &Config{
-		EnableMask:      true,
-		InterruptPrompt: "\n",
-		EOFPrompt:       "\n",
-		HistoryLimit:    -1,
-		Painter:         &defaultPainter{},
-
-		Stdout: o.o.cfg.Stdout,
-		Stderr: o.o.cfg.Stderr,
-	}
-}
diff --git a/vendor/github.com/chzyer/readline/rawreader_windows.go b/vendor/github.com/chzyer/readline/rawreader_windows.go
deleted file mode 100644
index 073ef15..0000000
--- a/vendor/github.com/chzyer/readline/rawreader_windows.go
+++ /dev/null
@@ -1,125 +0,0 @@
-// +build windows
-
-package readline
-
-import "unsafe"
-
-const (
-	VK_CANCEL   = 0x03
-	VK_BACK     = 0x08
-	VK_TAB      = 0x09
-	VK_RETURN   = 0x0D
-	VK_SHIFT    = 0x10
-	VK_CONTROL  = 0x11
-	VK_MENU     = 0x12
-	VK_ESCAPE   = 0x1B
-	VK_LEFT     = 0x25
-	VK_UP       = 0x26
-	VK_RIGHT    = 0x27
-	VK_DOWN     = 0x28
-	VK_DELETE   = 0x2E
-	VK_LSHIFT   = 0xA0
-	VK_RSHIFT   = 0xA1
-	VK_LCONTROL = 0xA2
-	VK_RCONTROL = 0xA3
-)
-
-// RawReader translate input record to ANSI escape sequence.
-// To provides same behavior as unix terminal.
-type RawReader struct {
-	ctrlKey bool
-	altKey  bool
-}
-
-func NewRawReader() *RawReader {
-	r := new(RawReader)
-	return r
-}
-
-// only process one action in one read
-func (r *RawReader) Read(buf []byte) (int, error) {
-	ir := new(_INPUT_RECORD)
-	var read int
-	var err error
-next:
-	err = kernel.ReadConsoleInputW(stdin,
-		uintptr(unsafe.Pointer(ir)),
-		1,
-		uintptr(unsafe.Pointer(&read)),
-	)
-	if err != nil {
-		return 0, err
-	}
-	if ir.EventType != EVENT_KEY {
-		goto next
-	}
-	ker := (*_KEY_EVENT_RECORD)(unsafe.Pointer(&ir.Event[0]))
-	if ker.bKeyDown == 0 { // keyup
-		if r.ctrlKey || r.altKey {
-			switch ker.wVirtualKeyCode {
-			case VK_RCONTROL, VK_LCONTROL:
-				r.ctrlKey = false
-			case VK_MENU: //alt
-				r.altKey = false
-			}
-		}
-		goto next
-	}
-
-	if ker.unicodeChar == 0 {
-		var target rune
-		switch ker.wVirtualKeyCode {
-		case VK_RCONTROL, VK_LCONTROL:
-			r.ctrlKey = true
-		case VK_MENU: //alt
-			r.altKey = true
-		case VK_LEFT:
-			target = CharBackward
-		case VK_RIGHT:
-			target = CharForward
-		case VK_UP:
-			target = CharPrev
-		case VK_DOWN:
-			target = CharNext
-		}
-		if target != 0 {
-			return r.write(buf, target)
-		}
-		goto next
-	}
-	char := rune(ker.unicodeChar)
-	if r.ctrlKey {
-		switch char {
-		case 'A':
-			char = CharLineStart
-		case 'E':
-			char = CharLineEnd
-		case 'R':
-			char = CharBckSearch
-		case 'S':
-			char = CharFwdSearch
-		}
-	} else if r.altKey {
-		switch char {
-		case VK_BACK:
-			char = CharBackspace
-		}
-		return r.writeEsc(buf, char)
-	}
-	return r.write(buf, char)
-}
-
-func (r *RawReader) writeEsc(b []byte, char rune) (int, error) {
-	b[0] = '\033'
-	n := copy(b[1:], []byte(string(char)))
-	return n + 1, nil
-}
-
-func (r *RawReader) write(b []byte, char rune) (int, error) {
-	n := copy(b, []byte(string(char)))
-	return n, nil
-}
-
-func (r *RawReader) Close() error {
-	return nil
-}
diff --git a/vendor/github.com/chzyer/readline/readline.go b/vendor/github.com/chzyer/readline/readline.go
deleted file mode 100644
index 63b9171..0000000
--- a/vendor/github.com/chzyer/readline/readline.go
+++ /dev/null
@@ -1,338 +0,0 @@
-// Readline is a pure go implementation for GNU-Readline kind library.
-//
-// example:
-// 	rl, err := readline.New("> ")
-// 	if err != nil {
-// 		panic(err)
-// 	}
-// 	defer rl.Close()
-//
-// 	for {
-// 		line, err := rl.Readline()
-// 		if err != nil { // io.EOF
-// 			break
-// 		}
-// 		println(line)
-// 	}
-//
-package readline
-
-import (
-	"io"
-)
-
-type Instance struct {
-	Config    *Config
-	Terminal  *Terminal
-	Operation *Operation
-}
-
-type Config struct {
-	// prompt supports ANSI escape sequence, so we can color some characters even in windows
-	Prompt string
-
-	// readline will persist historys to file where HistoryFile specified
-	HistoryFile string
-	// specify the max length of historys, it's 500 by default, set it to -1 to disable history
-	HistoryLimit           int
-	DisableAutoSaveHistory bool
-	// enable case-insensitive history searching
-	HistorySearchFold bool
-
-	// AutoCompleter will called once user press TAB
-	AutoComplete AutoCompleter
-
-	// Any key press will pass to Listener
-	// NOTE: Listener will be triggered by (nil, 0, 0) immediately
-	Listener Listener
-
-	Painter Painter
-
-	// If VimMode is true, readline will in vim.insert mode by default
-	VimMode bool
-
-	InterruptPrompt string
-	EOFPrompt       string
-
-	FuncGetWidth func() int
-
-	Stdin       io.ReadCloser
-	StdinWriter io.Writer
-	Stdout      io.Writer
-	Stderr      io.Writer
-
-	EnableMask bool
-	MaskRune   rune
-
-	// erase the editing line after user submited it
-	// it use in IM usually.
-	UniqueEditLine bool
-
-	// filter input runes (may be used to disable CtrlZ or for translating some keys to different actions)
-	// -> output = new (translated) rune and true/false if continue with processing this one
-	FuncFilterInputRune func(rune) (rune, bool)
-
-	// force use interactive even stdout is not a tty
-	FuncIsTerminal      func() bool
-	FuncMakeRaw         func() error
-	FuncExitRaw         func() error
-	FuncOnWidthChanged  func(func())
-	ForceUseInteractive bool
-
-	// private fields
-	inited    bool
-	opHistory *opHistory
-	opSearch  *opSearch
-}
-
-func (c *Config) useInteractive() bool {
-	if c.ForceUseInteractive {
-		return true
-	}
-	return c.FuncIsTerminal()
-}
-
-func (c *Config) Init() error {
-	if c.inited {
-		return nil
-	}
-	c.inited = true
-	if c.Stdin == nil {
-		c.Stdin = NewCancelableStdin(Stdin)
-	}
-
-	c.Stdin, c.StdinWriter = NewFillableStdin(c.Stdin)
-
-	if c.Stdout == nil {
-		c.Stdout = Stdout
-	}
-	if c.Stderr == nil {
-		c.Stderr = Stderr
-	}
-	if c.HistoryLimit == 0 {
-		c.HistoryLimit = 500
-	}
-
-	if c.InterruptPrompt == "" {
-		c.InterruptPrompt = "^C"
-	} else if c.InterruptPrompt == "\n" {
-		c.InterruptPrompt = ""
-	}
-	if c.EOFPrompt == "" {
-		c.EOFPrompt = "^D"
-	} else if c.EOFPrompt == "\n" {
-		c.EOFPrompt = ""
-	}
-
-	if c.AutoComplete == nil {
-		c.AutoComplete = &TabCompleter{}
-	}
-	if c.FuncGetWidth == nil {
-		c.FuncGetWidth = GetScreenWidth
-	}
-	if c.FuncIsTerminal == nil {
-		c.FuncIsTerminal = DefaultIsTerminal
-	}
-	rm := new(RawMode)
-	if c.FuncMakeRaw == nil {
-		c.FuncMakeRaw = rm.Enter
-	}
-	if c.FuncExitRaw == nil {
-		c.FuncExitRaw = rm.Exit
-	}
-	if c.FuncOnWidthChanged == nil {
-		c.FuncOnWidthChanged = DefaultOnWidthChanged
-	}
-
-	return nil
-}
-
-func (c Config) Clone() *Config {
-	c.opHistory = nil
-	c.opSearch = nil
-	return &c
-}
-
-func (c *Config) SetListener(f func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)) {
-	c.Listener = FuncListener(f)
-}
-
-func (c *Config) SetPainter(p Painter) {
-	c.Painter = p
-}
-
-func NewEx(cfg *Config) (*Instance, error) {
-	t, err := NewTerminal(cfg)
-	if err != nil {
-		return nil, err
-	}
-	rl := t.Readline()
-	if cfg.Painter == nil {
-		cfg.Painter = &defaultPainter{}
-	}
-	return &Instance{
-		Config:    cfg,
-		Terminal:  t,
-		Operation: rl,
-	}, nil
-}
-
-func New(prompt string) (*Instance, error) {
-	return NewEx(&Config{Prompt: prompt})
-}
-
-func (i *Instance) ResetHistory() {
-	i.Operation.ResetHistory()
-}
-
-func (i *Instance) SetPrompt(s string) {
-	i.Operation.SetPrompt(s)
-}
-
-func (i *Instance) SetMaskRune(r rune) {
-	i.Operation.SetMaskRune(r)
-}
-
-// change history persistence in runtime
-func (i *Instance) SetHistoryPath(p string) {
-	i.Operation.SetHistoryPath(p)
-}
-
-// readline will refresh automatic when write through Stdout()
-func (i *Instance) Stdout() io.Writer {
-	return i.Operation.Stdout()
-}
-
-// readline will refresh automatic when write through Stdout()
-func (i *Instance) Stderr() io.Writer {
-	return i.Operation.Stderr()
-}
-
-// switch VimMode in runtime
-func (i *Instance) SetVimMode(on bool) {
-	i.Operation.SetVimMode(on)
-}
-
-func (i *Instance) IsVimMode() bool {
-	return i.Operation.IsEnableVimMode()
-}
-
-func (i *Instance) GenPasswordConfig() *Config {
-	return i.Operation.GenPasswordConfig()
-}
-
-// we can generate a config by `i.GenPasswordConfig()`
-func (i *Instance) ReadPasswordWithConfig(cfg *Config) ([]byte, error) {
-	return i.Operation.PasswordWithConfig(cfg)
-}
-
-func (i *Instance) ReadPasswordEx(prompt string, l Listener) ([]byte, error) {
-	return i.Operation.PasswordEx(prompt, l)
-}
-
-func (i *Instance) ReadPassword(prompt string) ([]byte, error) {
-	return i.Operation.Password(prompt)
-}
-
-type Result struct {
-	Line  string
-	Error error
-}
-
-func (l *Result) CanContinue() bool {
-	return len(l.Line) != 0 && l.Error == ErrInterrupt
-}
-
-func (l *Result) CanBreak() bool {
-	return !l.CanContinue() && l.Error != nil
-}
-
-func (i *Instance) Line() *Result {
-	ret, err := i.Readline()
-	return &Result{ret, err}
-}
-
-// err is one of (nil, io.EOF, readline.ErrInterrupt)
-func (i *Instance) Readline() (string, error) {
-	return i.Operation.String()
-}
-
-func (i *Instance) ReadlineWithDefault(what string) (string, error) {
-	i.Operation.SetBuffer(what)
-	return i.Operation.String()
-}
-
-func (i *Instance) SaveHistory(content string) error {
-	return i.Operation.SaveHistory(content)
-}
-
-// same as readline
-func (i *Instance) ReadSlice() ([]byte, error) {
-	return i.Operation.Slice()
-}
-
-// we must make sure that call Close() before process exit.
-// if there has a pending reading operation, that reading will be interrupted.
-// so you can capture the signal and call Instance.Close(), it's thread-safe.
-func (i *Instance) Close() error {
-	i.Config.Stdin.Close()
-	i.Operation.Close()
-	if err := i.Terminal.Close(); err != nil {
-		return err
-	}
-	return nil
-}
-
-// call CaptureExitSignal when you want readline exit gracefully.
-func (i *Instance) CaptureExitSignal() {
-	CaptureExitSignal(func() {
-		i.Close()
-	})
-}
-
-func (i *Instance) Clean() {
-	i.Operation.Clean()
-}
-
-func (i *Instance) Write(b []byte) (int, error) {
-	return i.Stdout().Write(b)
-}
-
-// WriteStdin prefill the next Stdin fetch
-// Next time you call ReadLine() this value will be writen before the user input
-// ie :
-//  i := readline.New()
-//  i.WriteStdin([]byte("test"))
-//  _, _= i.Readline()
-//
-// gives
-//
-// > test[cursor]
-func (i *Instance) WriteStdin(val []byte) (int, error) {
-	return i.Terminal.WriteStdin(val)
-}
-
-func (i *Instance) SetConfig(cfg *Config) *Config {
-	if i.Config == cfg {
-		return cfg
-	}
-	old := i.Config
-	i.Config = cfg
-	i.Operation.SetConfig(cfg)
-	i.Terminal.SetConfig(cfg)
-	return old
-}
-
-func (i *Instance) Refresh() {
-	i.Operation.Refresh()
-}
-
-// HistoryDisable the save of the commands into the history
-func (i *Instance) HistoryDisable() {
-	i.Operation.history.Disable()
-}
-
-// HistoryEnable the save of the commands into the history (default on)
-func (i *Instance) HistoryEnable() {
-	i.Operation.history.Enable()
-}
diff --git a/vendor/github.com/chzyer/readline/remote.go b/vendor/github.com/chzyer/readline/remote.go
deleted file mode 100644
index 74dbf56..0000000
--- a/vendor/github.com/chzyer/readline/remote.go
+++ /dev/null
@@ -1,475 +0,0 @@
-package readline
-
-import (
-	"bufio"
-	"bytes"
-	"encoding/binary"
-	"fmt"
-	"io"
-	"net"
-	"os"
-	"sync"
-	"sync/atomic"
-)
-
-type MsgType int16
-
-const (
-	T_DATA = MsgType(iota)
-	T_WIDTH
-	T_WIDTH_REPORT
-	T_ISTTY_REPORT
-	T_RAW
-	T_ERAW // exit raw
-	T_EOF
-)
-
-type RemoteSvr struct {
-	eof           int32
-	closed        int32
-	width         int32
-	reciveChan    chan struct{}
-	writeChan     chan *writeCtx
-	conn          net.Conn
-	isTerminal    bool
-	funcWidthChan func()
-	stopChan      chan struct{}
-
-	dataBufM sync.Mutex
-	dataBuf  bytes.Buffer
-}
-
-type writeReply struct {
-	n   int
-	err error
-}
-
-type writeCtx struct {
-	msg   *Message
-	reply chan *writeReply
-}
-
-func newWriteCtx(msg *Message) *writeCtx {
-	return &writeCtx{
-		msg:   msg,
-		reply: make(chan *writeReply),
-	}
-}
-
-func NewRemoteSvr(conn net.Conn) (*RemoteSvr, error) {
-	rs := &RemoteSvr{
-		width:      -1,
-		conn:       conn,
-		writeChan:  make(chan *writeCtx),
-		reciveChan: make(chan struct{}),
-		stopChan:   make(chan struct{}),
-	}
-	buf := bufio.NewReader(rs.conn)
-
-	if err := rs.init(buf); err != nil {
-		return nil, err
-	}
-
-	go rs.readLoop(buf)
-	go rs.writeLoop()
-	return rs, nil
-}
-
-func (r *RemoteSvr) init(buf *bufio.Reader) error {
-	m, err := ReadMessage(buf)
-	if err != nil {
-		return err
-	}
-	// receive isTerminal
-	if m.Type != T_ISTTY_REPORT {
-		return fmt.Errorf("unexpected init message")
-	}
-	r.GotIsTerminal(m.Data)
-
-	// receive width
-	m, err = ReadMessage(buf)
-	if err != nil {
-		return err
-	}
-	if m.Type != T_WIDTH_REPORT {
-		return fmt.Errorf("unexpected init message")
-	}
-	r.GotReportWidth(m.Data)
-
-	return nil
-}
-
-func (r *RemoteSvr) HandleConfig(cfg *Config) {
-	cfg.Stderr = r
-	cfg.Stdout = r
-	cfg.Stdin = r
-	cfg.FuncExitRaw = r.ExitRawMode
-	cfg.FuncIsTerminal = r.IsTerminal
-	cfg.FuncMakeRaw = r.EnterRawMode
-	cfg.FuncExitRaw = r.ExitRawMode
-	cfg.FuncGetWidth = r.GetWidth
-	cfg.FuncOnWidthChanged = func(f func()) {
-		r.funcWidthChan = f
-	}
-}
-
-func (r *RemoteSvr) IsTerminal() bool {
-	return r.isTerminal
-}
-
-func (r *RemoteSvr) checkEOF() error {
-	if atomic.LoadInt32(&r.eof) == 1 {
-		return io.EOF
-	}
-	return nil
-}
-
-func (r *RemoteSvr) Read(b []byte) (int, error) {
-	r.dataBufM.Lock()
-	n, err := r.dataBuf.Read(b)
-	r.dataBufM.Unlock()
-	if n == 0 {
-		if err := r.checkEOF(); err != nil {
-			return 0, err
-		}
-	}
-
-	if n == 0 && err == io.EOF {
-		<-r.reciveChan
-		r.dataBufM.Lock()
-		n, err = r.dataBuf.Read(b)
-		r.dataBufM.Unlock()
-	}
-	if n == 0 {
-		if err := r.checkEOF(); err != nil {
-			return 0, err
-		}
-	}
-
-	return n, err
-}
-
-func (r *RemoteSvr) writeMsg(m *Message) error {
-	ctx := newWriteCtx(m)
-	r.writeChan <- ctx
-	reply := <-ctx.reply
-	return reply.err
-}
-
-func (r *RemoteSvr) Write(b []byte) (int, error) {
-	ctx := newWriteCtx(NewMessage(T_DATA, b))
-	r.writeChan <- ctx
-	reply := <-ctx.reply
-	return reply.n, reply.err
-}
-
-func (r *RemoteSvr) EnterRawMode() error {
-	return r.writeMsg(NewMessage(T_RAW, nil))
-}
-
-func (r *RemoteSvr) ExitRawMode() error {
-	return r.writeMsg(NewMessage(T_ERAW, nil))
-}
-
-func (r *RemoteSvr) writeLoop() {
-	defer r.Close()
-
-loop:
-	for {
-		select {
-		case ctx, ok := <-r.writeChan:
-			if !ok {
-				break
-			}
-			n, err := ctx.msg.WriteTo(r.conn)
-			ctx.reply <- &writeReply{n, err}
-		case <-r.stopChan:
-			break loop
-		}
-	}
-}
-
-func (r *RemoteSvr) Close() error {
-	if atomic.CompareAndSwapInt32(&r.closed, 0, 1) {
-		close(r.stopChan)
-		r.conn.Close()
-	}
-	return nil
-}
-
-func (r *RemoteSvr) readLoop(buf *bufio.Reader) {
-	defer r.Close()
-	for {
-		m, err := ReadMessage(buf)
-		if err != nil {
-			break
-		}
-		switch m.Type {
-		case T_EOF:
-			atomic.StoreInt32(&r.eof, 1)
-			select {
-			case r.reciveChan <- struct{}{}:
-			default:
-			}
-		case T_DATA:
-			r.dataBufM.Lock()
-			r.dataBuf.Write(m.Data)
-			r.dataBufM.Unlock()
-			select {
-			case r.reciveChan <- struct{}{}:
-			default:
-			}
-		case T_WIDTH_REPORT:
-			r.GotReportWidth(m.Data)
-		case T_ISTTY_REPORT:
-			r.GotIsTerminal(m.Data)
-		}
-	}
-}
-
-func (r *RemoteSvr) GotIsTerminal(data []byte) {
-	if binary.BigEndian.Uint16(data) == 0 {
-		r.isTerminal = false
-	} else {
-		r.isTerminal = true
-	}
-}
-
-func (r *RemoteSvr) GotReportWidth(data []byte) {
-	atomic.StoreInt32(&r.width, int32(binary.BigEndian.Uint16(data)))
-	if r.funcWidthChan != nil {
-		r.funcWidthChan()
-	}
-}
-
-func (r *RemoteSvr) GetWidth() int {
-	return int(atomic.LoadInt32(&r.width))
-}
-
-// -----------------------------------------------------------------------------
-
-type Message struct {
-	Type MsgType
-	Data []byte
-}
-
-func ReadMessage(r io.Reader) (*Message, error) {
-	m := new(Message)
-	var length int32
-	if err := binary.Read(r, binary.BigEndian, &length); err != nil {
-		return nil, err
-	}
-	if err := binary.Read(r, binary.BigEndian, &m.Type); err != nil {
-		return nil, err
-	}
-	m.Data = make([]byte, int(length)-2)
-	if _, err := io.ReadFull(r, m.Data); err != nil {
-		return nil, err
-	}
-	return m, nil
-}
-
-func NewMessage(t MsgType, data []byte) *Message {
-	return &Message{t, data}
-}
-
-func (m *Message) WriteTo(w io.Writer) (int, error) {
-	buf := bytes.NewBuffer(make([]byte, 0, len(m.Data)+2+4))
-	binary.Write(buf, binary.BigEndian, int32(len(m.Data)+2))
-	binary.Write(buf, binary.BigEndian, m.Type)
-	buf.Write(m.Data)
-	n, err := buf.WriteTo(w)
-	return int(n), err
-}
-
-// -----------------------------------------------------------------------------
-
-type RemoteCli struct {
-	conn        net.Conn
-	raw         RawMode
-	receiveChan chan struct{}
-	inited      int32
-	isTerminal  *bool
-
-	data  bytes.Buffer
-	dataM sync.Mutex
-}
-
-func NewRemoteCli(conn net.Conn) (*RemoteCli, error) {
-	r := &RemoteCli{
-		conn:        conn,
-		receiveChan: make(chan struct{}),
-	}
-	return r, nil
-}
-
-func (r *RemoteCli) MarkIsTerminal(is bool) {
-	r.isTerminal = &is
-}
-
-func (r *RemoteCli) init() error {
-	if !atomic.CompareAndSwapInt32(&r.inited, 0, 1) {
-		return nil
-	}
-
-	if err := r.reportIsTerminal(); err != nil {
-		return err
-	}
-
-	if err := r.reportWidth(); err != nil {
-		return err
-	}
-
-	// register sig for width changed
-	DefaultOnWidthChanged(func() {
-		r.reportWidth()
-	})
-	return nil
-}
-
-func (r *RemoteCli) writeMsg(m *Message) error {
-	r.dataM.Lock()
-	_, err := m.WriteTo(r.conn)
-	r.dataM.Unlock()
-	return err
-}
-
-func (r *RemoteCli) Write(b []byte) (int, error) {
-	m := NewMessage(T_DATA, b)
-	r.dataM.Lock()
-	_, err := m.WriteTo(r.conn)
-	r.dataM.Unlock()
-	return len(b), err
-}
-
-func (r *RemoteCli) reportWidth() error {
-	screenWidth := GetScreenWidth()
-	data := make([]byte, 2)
-	binary.BigEndian.PutUint16(data, uint16(screenWidth))
-	msg := NewMessage(T_WIDTH_REPORT, data)
-
-	if err := r.writeMsg(msg); err != nil {
-		return err
-	}
-	return nil
-}
-
-func (r *RemoteCli) reportIsTerminal() error {
-	var isTerminal bool
-	if r.isTerminal != nil {
-		isTerminal = *r.isTerminal
-	} else {
-		isTerminal = DefaultIsTerminal()
-	}
-	data := make([]byte, 2)
-	if isTerminal {
-		binary.BigEndian.PutUint16(data, 1)
-	} else {
-		binary.BigEndian.PutUint16(data, 0)
-	}
-	msg := NewMessage(T_ISTTY_REPORT, data)
-	if err := r.writeMsg(msg); err != nil {
-		return err
-	}
-	return nil
-}
-
-func (r *RemoteCli) readLoop() {
-	buf := bufio.NewReader(r.conn)
-	for {
-		msg, err := ReadMessage(buf)
-		if err != nil {
-			break
-		}
-		switch msg.Type {
-		case T_ERAW:
-			r.raw.Exit()
-		case T_RAW:
-			r.raw.Enter()
-		case T_DATA:
-			os.Stdout.Write(msg.Data)
-		}
-	}
-}
-
-func (r *RemoteCli) ServeBy(source io.Reader) error {
-	if err := r.init(); err != nil {
-		return err
-	}
-
-	go func() {
-		defer r.Close()
-		for {
-			n, _ := io.Copy(r, source)
-			if n == 0 {
-				break
-			}
-		}
-	}()
-	defer r.raw.Exit()
-	r.readLoop()
-	return nil
-}
-
-func (r *RemoteCli) Close() {
-	r.writeMsg(NewMessage(T_EOF, nil))
-}
-
-func (r *RemoteCli) Serve() error {
-	return r.ServeBy(os.Stdin)
-}
-
-func ListenRemote(n, addr string, cfg *Config, h func(*Instance), onListen ...func(net.Listener) error) error {
-	ln, err := net.Listen(n, addr)
-	if err != nil {
-		return err
-	}
-	if len(onListen) > 0 {
-		if err := onListen[0](ln); err != nil {
-			return err
-		}
-	}
-	for {
-		conn, err := ln.Accept()
-		if err != nil {
-			break
-		}
-		go func() {
-			defer conn.Close()
-			rl, err := HandleConn(*cfg, conn)
-			if err != nil {
-				return
-			}
-			h(rl)
-		}()
-	}
-	return nil
-}
-
-func HandleConn(cfg Config, conn net.Conn) (*Instance, error) {
-	r, err := NewRemoteSvr(conn)
-	if err != nil {
-		return nil, err
-	}
-	r.HandleConfig(&cfg)
-
-	rl, err := NewEx(&cfg)
-	if err != nil {
-		return nil, err
-	}
-	return rl, nil
-}
-
-func DialRemote(n, addr string) error {
-	conn, err := net.Dial(n, addr)
-	if err != nil {
-		return err
-	}
-	defer conn.Close()
-
-	cli, err := NewRemoteCli(conn)
-	if err != nil {
-		return err
-	}
-	return cli.Serve()
-}
diff --git a/vendor/github.com/chzyer/readline/runebuf.go b/vendor/github.com/chzyer/readline/runebuf.go
deleted file mode 100644
index d95df1e..0000000
--- a/vendor/github.com/chzyer/readline/runebuf.go
+++ /dev/null
@@ -1,629 +0,0 @@
-package readline
-
-import (
-	"bufio"
-	"bytes"
-	"io"
-	"strconv"
-	"strings"
-	"sync"
-)
-
-type runeBufferBck struct {
-	buf []rune
-	idx int
-}
-
-type RuneBuffer struct {
-	buf    []rune
-	idx    int
-	prompt []rune
-	w      io.Writer
-
-	hadClean    bool
-	interactive bool
-	cfg         *Config
-
-	width int
-
-	bck *runeBufferBck
-
-	offset string
-
-	lastKill []rune
-
-	sync.Mutex
-}
-
-func (r *RuneBuffer) pushKill(text []rune) {
-	r.lastKill = append([]rune{}, text...)
-}
-
-func (r *RuneBuffer) OnWidthChange(newWidth int) {
-	r.Lock()
-	r.width = newWidth
-	r.Unlock()
-}
-
-func (r *RuneBuffer) Backup() {
-	r.Lock()
-	r.bck = &runeBufferBck{r.buf, r.idx}
-	r.Unlock()
-}
-
-func (r *RuneBuffer) Restore() {
-	r.Refresh(func() {
-		if r.bck == nil {
-			return
-		}
-		r.buf = r.bck.buf
-		r.idx = r.bck.idx
-	})
-}
-
-func NewRuneBuffer(w io.Writer, prompt string, cfg *Config, width int) *RuneBuffer {
-	rb := &RuneBuffer{
-		w:           w,
-		interactive: cfg.useInteractive(),
-		cfg:         cfg,
-		width:       width,
-	}
-	rb.SetPrompt(prompt)
-	return rb
-}
-
-func (r *RuneBuffer) SetConfig(cfg *Config) {
-	r.Lock()
-	r.cfg = cfg
-	r.interactive = cfg.useInteractive()
-	r.Unlock()
-}
-
-func (r *RuneBuffer) SetMask(m rune) {
-	r.Lock()
-	r.cfg.MaskRune = m
-	r.Unlock()
-}
-
-func (r *RuneBuffer) CurrentWidth(x int) int {
-	r.Lock()
-	defer r.Unlock()
-	return runes.WidthAll(r.buf[:x])
-}
-
-func (r *RuneBuffer) PromptLen() int {
-	r.Lock()
-	width := r.promptLen()
-	r.Unlock()
-	return width
-}
-
-func (r *RuneBuffer) promptLen() int {
-	return runes.WidthAll(runes.ColorFilter(r.prompt))
-}
-
-func (r *RuneBuffer) RuneSlice(i int) []rune {
-	r.Lock()
-	defer r.Unlock()
-
-	if i > 0 {
-		rs := make([]rune, i)
-		copy(rs, r.buf[r.idx:r.idx+i])
-		return rs
-	}
-	rs := make([]rune, -i)
-	copy(rs, r.buf[r.idx+i:r.idx])
-	return rs
-}
-
-func (r *RuneBuffer) Runes() []rune {
-	r.Lock()
-	newr := make([]rune, len(r.buf))
-	copy(newr, r.buf)
-	r.Unlock()
-	return newr
-}
-
-func (r *RuneBuffer) Pos() int {
-	r.Lock()
-	defer r.Unlock()
-	return r.idx
-}
-
-func (r *RuneBuffer) Len() int {
-	r.Lock()
-	defer r.Unlock()
-	return len(r.buf)
-}
-
-func (r *RuneBuffer) MoveToLineStart() {
-	r.Refresh(func() {
-		if r.idx == 0 {
-			return
-		}
-		r.idx = 0
-	})
-}
-
-func (r *RuneBuffer) MoveBackward() {
-	r.Refresh(func() {
-		if r.idx == 0 {
-			return
-		}
-		r.idx--
-	})
-}
-
-func (r *RuneBuffer) WriteString(s string) {
-	r.WriteRunes([]rune(s))
-}
-
-func (r *RuneBuffer) WriteRune(s rune) {
-	r.WriteRunes([]rune{s})
-}
-
-func (r *RuneBuffer) WriteRunes(s []rune) {
-	r.Refresh(func() {
-		tail := append(s, r.buf[r.idx:]...)
-		r.buf = append(r.buf[:r.idx], tail...)
-		r.idx += len(s)
-	})
-}
-
-func (r *RuneBuffer) MoveForward() {
-	r.Refresh(func() {
-		if r.idx == len(r.buf) {
-			return
-		}
-		r.idx++
-	})
-}
-
-func (r *RuneBuffer) IsCursorInEnd() bool {
-	r.Lock()
-	defer r.Unlock()
-	return r.idx == len(r.buf)
-}
-
-func (r *RuneBuffer) Replace(ch rune) {
-	r.Refresh(func() {
-		r.buf[r.idx] = ch
-	})
-}
-
-func (r *RuneBuffer) Erase() {
-	r.Refresh(func() {
-		r.idx = 0
-		r.pushKill(r.buf[:])
-		r.buf = r.buf[:0]
-	})
-}
-
-func (r *RuneBuffer) Delete() (success bool) {
-	r.Refresh(func() {
-		if r.idx == len(r.buf) {
-			return
-		}
-		r.pushKill(r.buf[r.idx : r.idx+1])
-		r.buf = append(r.buf[:r.idx], r.buf[r.idx+1:]...)
-		success = true
-	})
-	return
-}
-
-func (r *RuneBuffer) DeleteWord() {
-	if r.idx == len(r.buf) {
-		return
-	}
-	init := r.idx
-	for init < len(r.buf) && IsWordBreak(r.buf[init]) {
-		init++
-	}
-	for i := init + 1; i < len(r.buf); i++ {
-		if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
-			r.pushKill(r.buf[r.idx : i-1])
-			r.Refresh(func() {
-				r.buf = append(r.buf[:r.idx], r.buf[i-1:]...)
-			})
-			return
-		}
-	}
-	r.Kill()
-}
-
-func (r *RuneBuffer) MoveToPrevWord() (success bool) {
-	r.Refresh(func() {
-		if r.idx == 0 {
-			return
-		}
-
-		for i := r.idx - 1; i > 0; i-- {
-			if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
-				r.idx = i
-				success = true
-				return
-			}
-		}
-		r.idx = 0
-		success = true
-	})
-	return
-}
-
-func (r *RuneBuffer) KillFront() {
-	r.Refresh(func() {
-		if r.idx == 0 {
-			return
-		}
-
-		length := len(r.buf) - r.idx
-		r.pushKill(r.buf[:r.idx])
-		copy(r.buf[:length], r.buf[r.idx:])
-		r.idx = 0
-		r.buf = r.buf[:length]
-	})
-}
-
-func (r *RuneBuffer) Kill() {
-	r.Refresh(func() {
-		r.pushKill(r.buf[r.idx:])
-		r.buf = r.buf[:r.idx]
-	})
-}
-
-func (r *RuneBuffer) Transpose() {
-	r.Refresh(func() {
-		if len(r.buf) == 1 {
-			r.idx++
-		}
-
-		if len(r.buf) < 2 {
-			return
-		}
-
-		if r.idx == 0 {
-			r.idx = 1
-		} else if r.idx >= len(r.buf) {
-			r.idx = len(r.buf) - 1
-		}
-		r.buf[r.idx], r.buf[r.idx-1] = r.buf[r.idx-1], r.buf[r.idx]
-		r.idx++
-	})
-}
-
-func (r *RuneBuffer) MoveToNextWord() {
-	r.Refresh(func() {
-		for i := r.idx + 1; i < len(r.buf); i++ {
-			if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
-				r.idx = i
-				return
-			}
-		}
-
-		r.idx = len(r.buf)
-	})
-}
-
-func (r *RuneBuffer) MoveToEndWord() {
-	r.Refresh(func() {
-		// already at the end, so do nothing
-		if r.idx == len(r.buf) {
-			return
-		}
-		// if we are at the end of a word already, go to next
-		if !IsWordBreak(r.buf[r.idx]) && IsWordBreak(r.buf[r.idx+1]) {
-			r.idx++
-		}
-
-		// keep going until at the end of a word
-		for i := r.idx + 1; i < len(r.buf); i++ {
-			if IsWordBreak(r.buf[i]) && !IsWordBreak(r.buf[i-1]) {
-				r.idx = i - 1
-				return
-			}
-		}
-		r.idx = len(r.buf)
-	})
-}
-
-func (r *RuneBuffer) BackEscapeWord() {
-	r.Refresh(func() {
-		if r.idx == 0 {
-			return
-		}
-		for i := r.idx - 1; i > 0; i-- {
-			if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
-				r.pushKill(r.buf[i:r.idx])
-				r.buf = append(r.buf[:i], r.buf[r.idx:]...)
-				r.idx = i
-				return
-			}
-		}
-
-		r.buf = r.buf[:0]
-		r.idx = 0
-	})
-}
-
-func (r *RuneBuffer) Yank() {
-	if len(r.lastKill) == 0 {
-		return
-	}
-	r.Refresh(func() {
-		buf := make([]rune, 0, len(r.buf)+len(r.lastKill))
-		buf = append(buf, r.buf[:r.idx]...)
-		buf = append(buf, r.lastKill...)
-		buf = append(buf, r.buf[r.idx:]...)
-		r.buf = buf
-		r.idx += len(r.lastKill)
-	})
-}
-
-func (r *RuneBuffer) Backspace() {
-	r.Refresh(func() {
-		if r.idx == 0 {
-			return
-		}
-
-		r.idx--
-		r.buf = append(r.buf[:r.idx], r.buf[r.idx+1:]...)
-	})
-}
-
-func (r *RuneBuffer) MoveToLineEnd() {
-	r.Refresh(func() {
-		if r.idx == len(r.buf) {
-			return
-		}
-
-		r.idx = len(r.buf)
-	})
-}
-
-func (r *RuneBuffer) LineCount(width int) int {
-	if width == -1 {
-		width = r.width
-	}
-	return LineCount(width,
-		runes.WidthAll(r.buf)+r.PromptLen())
-}
-
-func (r *RuneBuffer) MoveTo(ch rune, prevChar, reverse bool) (success bool) {
-	r.Refresh(func() {
-		if reverse {
-			for i := r.idx - 1; i >= 0; i-- {
-				if r.buf[i] == ch {
-					r.idx = i
-					if prevChar {
-						r.idx++
-					}
-					success = true
-					return
-				}
-			}
-			return
-		}
-		for i := r.idx + 1; i < len(r.buf); i++ {
-			if r.buf[i] == ch {
-				r.idx = i
-				if prevChar {
-					r.idx--
-				}
-				success = true
-				return
-			}
-		}
-	})
-	return
-}
-
-func (r *RuneBuffer) isInLineEdge() bool {
-	if isWindows {
-		return false
-	}
-	sp := r.getSplitByLine(r.buf)
-	return len(sp[len(sp)-1]) == 0
-}
-
-func (r *RuneBuffer) getSplitByLine(rs []rune) []string {
-	return SplitByLine(r.promptLen(), r.width, rs)
-}
-
-func (r *RuneBuffer) IdxLine(width int) int {
-	r.Lock()
-	defer r.Unlock()
-	return r.idxLine(width)
-}
-
-func (r *RuneBuffer) idxLine(width int) int {
-	if width == 0 {
-		return 0
-	}
-	sp := r.getSplitByLine(r.buf[:r.idx])
-	return len(sp) - 1
-}
-
-func (r *RuneBuffer) CursorLineCount() int {
-	return r.LineCount(r.width) - r.IdxLine(r.width)
-}
-
-func (r *RuneBuffer) Refresh(f func()) {
-	r.Lock()
-	defer r.Unlock()
-
-	if !r.interactive {
-		if f != nil {
-			f()
-		}
-		return
-	}
-
-	r.clean()
-	if f != nil {
-		f()
-	}
-	r.print()
-}
-
-func (r *RuneBuffer) SetOffset(offset string) {
-	r.Lock()
-	r.offset = offset
-	r.Unlock()
-}
-
-func (r *RuneBuffer) print() {
-	r.w.Write(r.output())
-	r.hadClean = false
-}
-
-func (r *RuneBuffer) output() []byte {
-	buf := bytes.NewBuffer(nil)
-	buf.WriteString(string(r.prompt))
-	if r.cfg.EnableMask && len(r.buf) > 0 {
-		buf.Write([]byte(strings.Repeat(string(r.cfg.MaskRune), len(r.buf)-1)))
-		if r.buf[len(r.buf)-1] == '\n' {
-			buf.Write([]byte{'\n'})
-		} else {
-			buf.Write([]byte(string(r.cfg.MaskRune)))
-		}
-		if len(r.buf) > r.idx {
-			buf.Write(r.getBackspaceSequence())
-		}
-
-	} else {
-		for _, e := range r.cfg.Painter.Paint(r.buf, r.idx) {
-			if e == '\t' {
-				buf.WriteString(strings.Repeat(" ", TabWidth))
-			} else {
-				buf.WriteRune(e)
-			}
-		}
-		if r.isInLineEdge() {
-			buf.Write([]byte(" \b"))
-		}
-	}
-	// cursor position
-	if len(r.buf) > r.idx {
-		buf.Write(r.getBackspaceSequence())
-	}
-	return buf.Bytes()
-}
-
-func (r *RuneBuffer) getBackspaceSequence() []byte {
-	var sep = map[int]bool{}
-
-	var i int
-	for {
-		if i >= runes.WidthAll(r.buf) {
-			break
-		}
-
-		if i == 0 {
-			i -= r.promptLen()
-		}
-		i += r.width
-
-		sep[i] = true
-	}
-	var buf []byte
-	for i := len(r.buf); i > r.idx; i-- {
-		// move input to the left of one
-		buf = append(buf, '\b')
-		if sep[i] {
-			// up one line, go to the start of the line and move cursor right to the end (r.width)
-			buf = append(buf, "\033[A\r"+"\033["+strconv.Itoa(r.width)+"C"...)
-		}
-	}
-
-	return buf
-
-}
-
-func (r *RuneBuffer) Reset() []rune {
-	ret := runes.Copy(r.buf)
-	r.buf = r.buf[:0]
-	r.idx = 0
-	return ret
-}
-
-func (r *RuneBuffer) calWidth(m int) int {
-	if m > 0 {
-		return runes.WidthAll(r.buf[r.idx : r.idx+m])
-	}
-	return runes.WidthAll(r.buf[r.idx+m : r.idx])
-}
-
-func (r *RuneBuffer) SetStyle(start, end int, style string) {
-	if end < start {
-		panic("end < start")
-	}
-
-	// goto start
-	move := start - r.idx
-	if move > 0 {
-		r.w.Write([]byte(string(r.buf[r.idx : r.idx+move])))
-	} else {
-		r.w.Write(bytes.Repeat([]byte("\b"), r.calWidth(move)))
-	}
-	r.w.Write([]byte("\033[" + style + "m"))
-	r.w.Write([]byte(string(r.buf[start:end])))
-	r.w.Write([]byte("\033[0m"))
-	// TODO: move back
-}
-
-func (r *RuneBuffer) SetWithIdx(idx int, buf []rune) {
-	r.Refresh(func() {
-		r.buf = buf
-		r.idx = idx
-	})
-}
-
-func (r *RuneBuffer) Set(buf []rune) {
-	r.SetWithIdx(len(buf), buf)
-}
-
-func (r *RuneBuffer) SetPrompt(prompt string) {
-	r.Lock()
-	r.prompt = []rune(prompt)
-	r.Unlock()
-}
-
-func (r *RuneBuffer) cleanOutput(w io.Writer, idxLine int) {
-	buf := bufio.NewWriter(w)
-
-	if r.width == 0 {
-		buf.WriteString(strings.Repeat("\r\b", len(r.buf)+r.promptLen()))
-		buf.Write([]byte("\033[J"))
-	} else {
-		buf.Write([]byte("\033[J")) // just like ^k :)
-		if idxLine == 0 {
-			buf.WriteString("\033[2K")
-			buf.WriteString("\r")
-		} else {
-			for i := 0; i < idxLine; i++ {
-				io.WriteString(buf, "\033[2K\r\033[A")
-			}
-			io.WriteString(buf, "\033[2K\r")
-		}
-	}
-	buf.Flush()
-	return
-}
-
-func (r *RuneBuffer) Clean() {
-	r.Lock()
-	r.clean()
-	r.Unlock()
-}
-
-func (r *RuneBuffer) clean() {
-	r.cleanWithIdxLine(r.idxLine(r.width))
-}
-
-func (r *RuneBuffer) cleanWithIdxLine(idxLine int) {
-	if r.hadClean || !r.interactive {
-		return
-	}
-	r.hadClean = true
-	r.cleanOutput(r.w, idxLine)
-}
diff --git a/vendor/github.com/chzyer/readline/std.go b/vendor/github.com/chzyer/readline/std.go
deleted file mode 100644
index 61d44b7..0000000
--- a/vendor/github.com/chzyer/readline/std.go
+++ /dev/null
@@ -1,197 +0,0 @@
-package readline
-
-import (
-	"io"
-	"os"
-	"sync"
-	"sync/atomic"
-)
-
-var (
-	Stdin  io.ReadCloser  = os.Stdin
-	Stdout io.WriteCloser = os.Stdout
-	Stderr io.WriteCloser = os.Stderr
-)
-
-var (
-	std     *Instance
-	stdOnce sync.Once
-)
-
-// global instance will not submit history automatic
-func getInstance() *Instance {
-	stdOnce.Do(func() {
-		std, _ = NewEx(&Config{
-			DisableAutoSaveHistory: true,
-		})
-	})
-	return std
-}
-
-// let readline load history from filepath
-// and try to persist history into disk
-// set fp to "" to prevent readline persisting history to disk
-// so the `AddHistory` will return nil error forever.
-func SetHistoryPath(fp string) {
-	ins := getInstance()
-	cfg := ins.Config.Clone()
-	cfg.HistoryFile = fp
-	ins.SetConfig(cfg)
-}
-
-// set auto completer to global instance
-func SetAutoComplete(completer AutoCompleter) {
-	ins := getInstance()
-	cfg := ins.Config.Clone()
-	cfg.AutoComplete = completer
-	ins.SetConfig(cfg)
-}
-
-// add history to global instance manually
-// raise error only if `SetHistoryPath` is set with a non-empty path
-func AddHistory(content string) error {
-	ins := getInstance()
-	return ins.SaveHistory(content)
-}
-
-func Password(prompt string) ([]byte, error) {
-	ins := getInstance()
-	return ins.ReadPassword(prompt)
-}
-
-// readline with global configs
-func Line(prompt string) (string, error) {
-	ins := getInstance()
-	ins.SetPrompt(prompt)
-	return ins.Readline()
-}
-
-type CancelableStdin struct {
-	r      io.Reader
-	mutex  sync.Mutex
-	stop   chan struct{}
-	closed int32
-	notify chan struct{}
-	data   []byte
-	read   int
-	err    error
-}
-
-func NewCancelableStdin(r io.Reader) *CancelableStdin {
-	c := &CancelableStdin{
-		r:      r,
-		notify: make(chan struct{}),
-		stop:   make(chan struct{}),
-	}
-	go c.ioloop()
-	return c
-}
-
-func (c *CancelableStdin) ioloop() {
-loop:
-	for {
-		select {
-		case <-c.notify:
-			c.read, c.err = c.r.Read(c.data)
-			select {
-			case c.notify <- struct{}{}:
-			case <-c.stop:
-				break loop
-			}
-		case <-c.stop:
-			break loop
-		}
-	}
-}
-
-func (c *CancelableStdin) Read(b []byte) (n int, err error) {
-	c.mutex.Lock()
-	defer c.mutex.Unlock()
-	if atomic.LoadInt32(&c.closed) == 1 {
-		return 0, io.EOF
-	}
-
-	c.data = b
-	select {
-	case c.notify <- struct{}{}:
-	case <-c.stop:
-		return 0, io.EOF
-	}
-	select {
-	case <-c.notify:
-		return c.read, c.err
-	case <-c.stop:
-		return 0, io.EOF
-	}
-}
-
-func (c *CancelableStdin) Close() error {
-	if atomic.CompareAndSwapInt32(&c.closed, 0, 1) {
-		close(c.stop)
-	}
-	return nil
-}
-
-// FillableStdin is a stdin reader which can prepend some data before
-// reading into the real stdin
-type FillableStdin struct {
-	sync.Mutex
-	stdin       io.Reader
-	stdinBuffer io.ReadCloser
-	buf         []byte
-	bufErr      error
-}
-
-// NewFillableStdin gives you FillableStdin
-func NewFillableStdin(stdin io.Reader) (io.ReadCloser, io.Writer) {
-	r, w := io.Pipe()
-	s := &FillableStdin{
-		stdinBuffer: r,
-		stdin:       stdin,
-	}
-	s.ioloop()
-	return s, w
-}
-
-func (s *FillableStdin) ioloop() {
-	go func() {
-		for {
-			bufR := make([]byte, 100)
-			var n int
-			n, s.bufErr = s.stdinBuffer.Read(bufR)
-			if s.bufErr != nil {
-				if s.bufErr == io.ErrClosedPipe {
-					break
-				}
-			}
-			s.Lock()
-			s.buf = append(s.buf, bufR[:n]...)
-			s.Unlock()
-		}
-	}()
-}
-
-// Read will read from the local buffer and if no data, read from stdin
-func (s *FillableStdin) Read(p []byte) (n int, err error) {
-	s.Lock()
-	i := len(s.buf)
-	if len(p) < i {
-		i = len(p)
-	}
-	if i > 0 {
-		n := copy(p, s.buf)
-		s.buf = s.buf[:0]
-		cerr := s.bufErr
-		s.bufErr = nil
-		s.Unlock()
-		return n, cerr
-	}
-	s.Unlock()
-	n, err = s.stdin.Read(p)
-	return n, err
-}
-
-func (s *FillableStdin) Close() error {
-	s.stdinBuffer.Close()
-	return nil
-}
diff --git a/vendor/github.com/chzyer/readline/std_windows.go b/vendor/github.com/chzyer/readline/std_windows.go
deleted file mode 100644
index b10f91b..0000000
--- a/vendor/github.com/chzyer/readline/std_windows.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// +build windows
-
-package readline
-
-func init() {
-	Stdin = NewRawReader()
-	Stdout = NewANSIWriter(Stdout)
-	Stderr = NewANSIWriter(Stderr)
-}
diff --git a/vendor/github.com/chzyer/readline/term.go b/vendor/github.com/chzyer/readline/term.go
deleted file mode 100644
index ea5db93..0000000
--- a/vendor/github.com/chzyer/readline/term.go
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux,!appengine netbsd openbsd os400 solaris
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// 	oldState, err := terminal.MakeRaw(0)
-// 	if err != nil {
-// 	        panic(err)
-// 	}
-// 	defer terminal.Restore(0, oldState)
-package readline
-
-import (
-	"io"
-	"syscall"
-)
-
-// State contains the state of a terminal.
-type State struct {
-	termios Termios
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
-	_, err := getTermios(fd)
-	return err == nil
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
-	var oldState State
-
-	if termios, err := getTermios(fd); err != nil {
-		return nil, err
-	} else {
-		oldState.termios = *termios
-	}
-
-	newState := oldState.termios
-	// This attempts to replicate the behaviour documented for cfmakeraw in
-	// the termios(3) manpage.
-	newState.Iflag &^= syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK | syscall.ISTRIP | syscall.INLCR | syscall.IGNCR | syscall.ICRNL | syscall.IXON
-	// newState.Oflag &^= syscall.OPOST
-	newState.Lflag &^= syscall.ECHO | syscall.ECHONL | syscall.ICANON | syscall.ISIG | syscall.IEXTEN
-	newState.Cflag &^= syscall.CSIZE | syscall.PARENB
-	newState.Cflag |= syscall.CS8
-
-	newState.Cc[syscall.VMIN] = 1
-	newState.Cc[syscall.VTIME] = 0
-
-	return &oldState, setTermios(fd, &newState)
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
-	termios, err := getTermios(fd)
-	if err != nil {
-		return nil, err
-	}
-
-	return &State{termios: *termios}, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func restoreTerm(fd int, state *State) error {
-	return setTermios(fd, &state.termios)
-}
-
-// ReadPassword reads a line of input from a terminal without local echo.  This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
-	oldState, err := getTermios(fd)
-	if err != nil {
-		return nil, err
-	}
-
-	newState := oldState
-	newState.Lflag &^= syscall.ECHO
-	newState.Lflag |= syscall.ICANON | syscall.ISIG
-	newState.Iflag |= syscall.ICRNL
-	if err := setTermios(fd, newState); err != nil {
-		return nil, err
-	}
-
-	defer func() {
-		setTermios(fd, oldState)
-	}()
-
-	var buf [16]byte
-	var ret []byte
-	for {
-		n, err := syscall.Read(fd, buf[:])
-		if err != nil {
-			return nil, err
-		}
-		if n == 0 {
-			if len(ret) == 0 {
-				return nil, io.EOF
-			}
-			break
-		}
-		if buf[n-1] == '\n' {
-			n--
-		}
-		ret = append(ret, buf[:n]...)
-		if n < len(buf) {
-			break
-		}
-	}
-
-	return ret, nil
-}
diff --git a/vendor/github.com/chzyer/readline/term_bsd.go b/vendor/github.com/chzyer/readline/term_bsd.go
deleted file mode 100644
index 68b56ea..0000000
--- a/vendor/github.com/chzyer/readline/term_bsd.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd netbsd openbsd
-
-package readline
-
-import (
-	"syscall"
-	"unsafe"
-)
-
-func getTermios(fd int) (*Termios, error) {
-	termios := new(Termios)
-	_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TIOCGETA, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
-	if err != 0 {
-		return nil, err
-	}
-	return termios, nil
-}
-
-func setTermios(fd int, termios *Termios) error {
-	_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TIOCSETA, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
-	if err != 0 {
-		return err
-	}
-	return nil
-}
diff --git a/vendor/github.com/chzyer/readline/term_linux.go b/vendor/github.com/chzyer/readline/term_linux.go
deleted file mode 100644
index e3392b4..0000000
--- a/vendor/github.com/chzyer/readline/term_linux.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package readline
-
-import (
-	"syscall"
-	"unsafe"
-)
-
-// These constants are declared here, rather than importing
-// them from the syscall package as some syscall packages, even
-// on linux, for example gccgo, do not declare them.
-const ioctlReadTermios = 0x5401  // syscall.TCGETS
-const ioctlWriteTermios = 0x5402 // syscall.TCSETS
-
-func getTermios(fd int) (*Termios, error) {
-	termios := new(Termios)
-	_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
-	if err != 0 {
-		return nil, err
-	}
-	return termios, nil
-}
-
-func setTermios(fd int, termios *Termios) error {
-	_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
-	if err != 0 {
-		return err
-	}
-	return nil
-}
diff --git a/vendor/github.com/chzyer/readline/term_nosyscall6.go b/vendor/github.com/chzyer/readline/term_nosyscall6.go
deleted file mode 100644
index df92339..0000000
--- a/vendor/github.com/chzyer/readline/term_nosyscall6.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix os400 solaris
-
-package readline
-
-import "golang.org/x/sys/unix"
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (int, int, error) {
-	ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
-	if err != nil {
-		return 0, 0, err
-	}
-	return int(ws.Col), int(ws.Row), nil
-}
-
-type Termios unix.Termios
-
-func getTermios(fd int) (*Termios, error) {
-	termios, err := unix.IoctlGetTermios(fd, unix.TCGETS)
-	if err != nil {
-		return nil, err
-	}
-	return (*Termios)(termios), nil
-}
-
-func setTermios(fd int, termios *Termios) error {
-	return unix.IoctlSetTermios(fd, unix.TCSETSF, (*unix.Termios)(termios))
-}
diff --git a/vendor/github.com/chzyer/readline/term_unix.go b/vendor/github.com/chzyer/readline/term_unix.go
deleted file mode 100644
index d3ea242..0000000
--- a/vendor/github.com/chzyer/readline/term_unix.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd
-
-package readline
-
-import (
-	"syscall"
-	"unsafe"
-)
-
-type Termios syscall.Termios
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (int, int, error) {
-	var dimensions [4]uint16
-	_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&dimensions)), 0, 0, 0)
-	if err != 0 {
-		return 0, 0, err
-	}
-	return int(dimensions[1]), int(dimensions[0]), nil
-}
diff --git a/vendor/github.com/chzyer/readline/term_windows.go b/vendor/github.com/chzyer/readline/term_windows.go
deleted file mode 100644
index 1290e00..0000000
--- a/vendor/github.com/chzyer/readline/term_windows.go
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// 	oldState, err := terminal.MakeRaw(0)
-// 	if err != nil {
-// 	        panic(err)
-// 	}
-// 	defer terminal.Restore(0, oldState)
-package readline
-
-import (
-	"io"
-	"syscall"
-	"unsafe"
-)
-
-const (
-	enableLineInput       = 2
-	enableEchoInput       = 4
-	enableProcessedInput  = 1
-	enableWindowInput     = 8
-	enableMouseInput      = 16
-	enableInsertMode      = 32
-	enableQuickEditMode   = 64
-	enableExtendedFlags   = 128
-	enableAutoPosition    = 256
-	enableProcessedOutput = 1
-	enableWrapAtEolOutput = 2
-)
-
-var kernel32 = syscall.NewLazyDLL("kernel32.dll")
-
-var (
-	procGetConsoleMode             = kernel32.NewProc("GetConsoleMode")
-	procSetConsoleMode             = kernel32.NewProc("SetConsoleMode")
-	procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
-)
-
-type (
-	coord struct {
-		x short
-		y short
-	}
-	smallRect struct {
-		left   short
-		top    short
-		right  short
-		bottom short
-	}
-	consoleScreenBufferInfo struct {
-		size              coord
-		cursorPosition    coord
-		attributes        word
-		window            smallRect
-		maximumWindowSize coord
-	}
-)
-
-type State struct {
-	mode uint32
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
-	var st uint32
-	r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
-	return r != 0 && e == 0
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
-	var st uint32
-	_, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
-	if e != 0 {
-		return nil, error(e)
-	}
-	raw := st &^ (enableEchoInput | enableProcessedInput | enableLineInput | enableProcessedOutput)
-	_, _, e = syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(raw), 0)
-	if e != 0 {
-		return nil, error(e)
-	}
-	return &State{st}, nil
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
-	var st uint32
-	_, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
-	if e != 0 {
-		return nil, error(e)
-	}
-	return &State{st}, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func restoreTerm(fd int, state *State) error {
-	_, _, err := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(state.mode), 0)
-	return err
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
-	var info consoleScreenBufferInfo
-	_, _, e := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&info)), 0)
-	if e != 0 {
-		return 0, 0, error(e)
-	}
-	return int(info.size.x), int(info.size.y), nil
-}
-
-// ReadPassword reads a line of input from a terminal without local echo.  This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
-	var st uint32
-	_, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
-	if e != 0 {
-		return nil, error(e)
-	}
-	old := st
-
-	st &^= (enableEchoInput)
-	st |= (enableProcessedInput | enableLineInput | enableProcessedOutput)
-	_, _, e = syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(st), 0)
-	if e != 0 {
-		return nil, error(e)
-	}
-
-	defer func() {
-		syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(old), 0)
-	}()
-
-	var buf [16]byte
-	var ret []byte
-	for {
-		n, err := syscall.Read(syscall.Handle(fd), buf[:])
-		if err != nil {
-			return nil, err
-		}
-		if n == 0 {
-			if len(ret) == 0 {
-				return nil, io.EOF
-			}
-			break
-		}
-		if buf[n-1] == '\n' {
-			n--
-		}
-		if n > 0 && buf[n-1] == '\r' {
-			n--
-		}
-		ret = append(ret, buf[:n]...)
-		if n < len(buf) {
-			break
-		}
-	}
-
-	return ret, nil
-}
diff --git a/vendor/github.com/chzyer/readline/terminal.go b/vendor/github.com/chzyer/readline/terminal.go
deleted file mode 100644
index 38413d0..0000000
--- a/vendor/github.com/chzyer/readline/terminal.go
+++ /dev/null
@@ -1,254 +0,0 @@
-package readline
-
-import (
-	"bufio"
-	"fmt"
-	"io"
-	"strings"
-	"sync"
-	"sync/atomic"
-)
-
-type Terminal struct {
-	m         sync.Mutex
-	cfg       *Config
-	outchan   chan rune
-	closed    int32
-	stopChan  chan struct{}
-	kickChan  chan struct{}
-	wg        sync.WaitGroup
-	isReading int32
-	sleeping  int32
-
-	sizeChan chan string
-}
-
-func NewTerminal(cfg *Config) (*Terminal, error) {
-	if err := cfg.Init(); err != nil {
-		return nil, err
-	}
-	t := &Terminal{
-		cfg:      cfg,
-		kickChan: make(chan struct{}, 1),
-		outchan:  make(chan rune),
-		stopChan: make(chan struct{}, 1),
-		sizeChan: make(chan string, 1),
-	}
-
-	go t.ioloop()
-	return t, nil
-}
-
-// SleepToResume will sleep myself, and return only if I'm resumed.
-func (t *Terminal) SleepToResume() {
-	if !atomic.CompareAndSwapInt32(&t.sleeping, 0, 1) {
-		return
-	}
-	defer atomic.StoreInt32(&t.sleeping, 0)
-
-	t.ExitRawMode()
-	ch := WaitForResume()
-	SuspendMe()
-	<-ch
-	t.EnterRawMode()
-}
-
-func (t *Terminal) EnterRawMode() (err error) {
-	return t.cfg.FuncMakeRaw()
-}
-
-func (t *Terminal) ExitRawMode() (err error) {
-	return t.cfg.FuncExitRaw()
-}
-
-func (t *Terminal) Write(b []byte) (int, error) {
-	return t.cfg.Stdout.Write(b)
-}
-
-// WriteStdin prefill the next Stdin fetch
-// Next time you call ReadLine() this value will be writen before the user input
-func (t *Terminal) WriteStdin(b []byte) (int, error) {
-	return t.cfg.StdinWriter.Write(b)
-}
-
-type termSize struct {
-	left int
-	top  int
-}
-
-func (t *Terminal) GetOffset(f func(offset string)) {
-	go func() {
-		f(<-t.sizeChan)
-	}()
-	t.Write([]byte("\033[6n"))
-}
-
-func (t *Terminal) Print(s string) {
-	fmt.Fprintf(t.cfg.Stdout, "%s", s)
-}
-
-func (t *Terminal) PrintRune(r rune) {
-	fmt.Fprintf(t.cfg.Stdout, "%c", r)
-}
-
-func (t *Terminal) Readline() *Operation {
-	return NewOperation(t, t.cfg)
-}
-
-// return rune(0) if meet EOF
-func (t *Terminal) ReadRune() rune {
-	ch, ok := <-t.outchan
-	if !ok {
-		return rune(0)
-	}
-	return ch
-}
-
-func (t *Terminal) IsReading() bool {
-	return atomic.LoadInt32(&t.isReading) == 1
-}
-
-func (t *Terminal) KickRead() {
-	select {
-	case t.kickChan <- struct{}{}:
-	default:
-	}
-}
-
-func (t *Terminal) ioloop() {
-	t.wg.Add(1)
-	defer func() {
-		t.wg.Done()
-		close(t.outchan)
-	}()
-
-	var (
-		isEscape       bool
-		isEscapeEx     bool
-		isEscapeSS3    bool
-		expectNextChar bool
-	)
-
-	buf := bufio.NewReader(t.getStdin())
-	for {
-		if !expectNextChar {
-			atomic.StoreInt32(&t.isReading, 0)
-			select {
-			case <-t.kickChan:
-				atomic.StoreInt32(&t.isReading, 1)
-			case <-t.stopChan:
-				return
-			}
-		}
-		expectNextChar = false
-		r, _, err := buf.ReadRune()
-		if err != nil {
-			if strings.Contains(err.Error(), "interrupted system call") {
-				expectNextChar = true
-				continue
-			}
-			break
-		}
-
-		if isEscape {
-			isEscape = false
-			if r == CharEscapeEx {
-				// ^][
-				expectNextChar = true
-				isEscapeEx = true
-				continue
-			} else if r == CharO {
-				// ^]O
-				expectNextChar = true
-				isEscapeSS3 = true
-				continue
-			}
-			r = escapeKey(r, buf)
-		} else if isEscapeEx {
-			isEscapeEx = false
-			if key := readEscKey(r, buf); key != nil {
-				r = escapeExKey(key)
-				// offset
-				if key.typ == 'R' {
-					if _, _, ok := key.Get2(); ok {
-						select {
-						case t.sizeChan <- key.attr:
-						default:
-						}
-					}
-					expectNextChar = true
-					continue
-				}
-			}
-			if r == 0 {
-				expectNextChar = true
-				continue
-			}
-		} else if isEscapeSS3 {
-			isEscapeSS3 = false
-			if key := readEscKey(r, buf); key != nil {
-				r = escapeSS3Key(key)
-			}
-			if r == 0 {
-				expectNextChar = true
-				continue
-			}
-		}
-
-		expectNextChar = true
-		switch r {
-		case CharEsc:
-			if t.cfg.VimMode {
-				t.outchan <- r
-				break
-			}
-			isEscape = true
-		case CharInterrupt, CharEnter, CharCtrlJ, CharDelete:
-			expectNextChar = false
-			fallthrough
-		default:
-			t.outchan <- r
-		}
-	}
-
-}
-
-func (t *Terminal) Bell() {
-	fmt.Fprintf(t, "%c", CharBell)
-}
-
-func (t *Terminal) Close() error {
-	if atomic.SwapInt32(&t.closed, 1) != 0 {
-		return nil
-	}
-	if closer, ok := t.cfg.Stdin.(io.Closer); ok {
-		closer.Close()
-	}
-	close(t.stopChan)
-	t.wg.Wait()
-	return t.ExitRawMode()
-}
-
-func (t *Terminal) GetConfig() *Config {
-	t.m.Lock()
-	cfg := *t.cfg
-	t.m.Unlock()
-	return &cfg
-}
-
-func (t *Terminal) getStdin() io.Reader {
-	t.m.Lock()
-	r := t.cfg.Stdin
-	t.m.Unlock()
-	return r
-}
-
-func (t *Terminal) SetConfig(c *Config) error {
-	if err := c.Init(); err != nil {
-		return err
-	}
-	t.m.Lock()
-	t.cfg = c
-	t.m.Unlock()
-	return nil
-}
diff --git a/vendor/github.com/chzyer/readline/utils.go b/vendor/github.com/chzyer/readline/utils.go
deleted file mode 100644
index 0706dd4..0000000
--- a/vendor/github.com/chzyer/readline/utils.go
+++ /dev/null
@@ -1,311 +0,0 @@
-package readline
-
-import (
-	"bufio"
-	"bytes"
-	"container/list"
-	"fmt"
-	"os"
-	"os/signal"
-	"strconv"
-	"strings"
-	"sync"
-	"syscall"
-	"time"
-	"unicode"
-)
-
-var (
-	isWindows = false
-)
-
-const (
-	CharLineStart = 1
-	CharBackward  = 2
-	CharInterrupt = 3
-	CharDelete    = 4
-	CharLineEnd   = 5
-	CharForward   = 6
-	CharBell      = 7
-	CharCtrlH     = 8
-	CharTab       = 9
-	CharCtrlJ     = 10
-	CharKill      = 11
-	CharCtrlL     = 12
-	CharEnter     = 13
-	CharNext      = 14
-	CharPrev      = 16
-	CharBckSearch = 18
-	CharFwdSearch = 19
-	CharTranspose = 20
-	CharCtrlU     = 21
-	CharCtrlW     = 23
-	CharCtrlY     = 25
-	CharCtrlZ     = 26
-	CharEsc       = 27
-	CharO         = 79
-	CharEscapeEx  = 91
-	CharBackspace = 127
-)
-
-const (
-	MetaBackward rune = -iota - 1
-	MetaForward
-	MetaDelete
-	MetaBackspace
-	MetaTranspose
-)
-
-// WaitForResume need to call before current process got suspend.
-// It will run a ticker until a long duration is occurs,
-// which means this process is resumed.
-func WaitForResume() chan struct{} {
-	ch := make(chan struct{})
-	var wg sync.WaitGroup
-	wg.Add(1)
-	go func() {
-		ticker := time.NewTicker(10 * time.Millisecond)
-		t := time.Now()
-		wg.Done()
-		for {
-			now := <-ticker.C
-			if now.Sub(t) > 100*time.Millisecond {
-				break
-			}
-			t = now
-		}
-		ticker.Stop()
-		ch <- struct{}{}
-	}()
-	wg.Wait()
-	return ch
-}
-
-func Restore(fd int, state *State) error {
-	err := restoreTerm(fd, state)
-	if err != nil {
-		// errno 0 means everything is ok :)
-		if err.Error() == "errno 0" {
-			return nil
-		} else {
-			return err
-		}
-	}
-	return nil
-}
-
-func IsPrintable(key rune) bool {
-	isInSurrogateArea := key >= 0xd800 && key <= 0xdbff
-	return key >= 32 && !isInSurrogateArea
-}
-
-// translate Esc[X
-func escapeExKey(key *escapeKeyPair) rune {
-	var r rune
-	switch key.typ {
-	case 'D':
-		r = CharBackward
-	case 'C':
-		r = CharForward
-	case 'A':
-		r = CharPrev
-	case 'B':
-		r = CharNext
-	case 'H':
-		r = CharLineStart
-	case 'F':
-		r = CharLineEnd
-	case '~':
-		if key.attr == "3" {
-			r = CharDelete
-		}
-	default:
-	}
-	return r
-}
-
-// translate EscOX SS3 codes for up/down/etc.
-func escapeSS3Key(key *escapeKeyPair) rune {
-	var r rune
-	switch key.typ {
-	case 'D':
-		r = CharBackward
-	case 'C':
-		r = CharForward
-	case 'A':
-		r = CharPrev
-	case 'B':
-		r = CharNext
-	case 'H':
-		r = CharLineStart
-	case 'F':
-		r = CharLineEnd
-	default:
-	}
-	return r
-}
-
-type escapeKeyPair struct {
-	attr string
-	typ  rune
-}
-
-func (e *escapeKeyPair) Get2() (int, int, bool) {
-	sp := strings.Split(e.attr, ";")
-	if len(sp) < 2 {
-		return -1, -1, false
-	}
-	s1, err := strconv.Atoi(sp[0])
-	if err != nil {
-		return -1, -1, false
-	}
-	s2, err := strconv.Atoi(sp[1])
-	if err != nil {
-		return -1, -1, false
-	}
-	return s1, s2, true
-}
-
-func readEscKey(r rune, reader *bufio.Reader) *escapeKeyPair {
-	p := escapeKeyPair{}
-	buf := bytes.NewBuffer(nil)
-	for {
-		if r == ';' {
-		} else if unicode.IsNumber(r) {
-		} else {
-			p.typ = r
-			break
-		}
-		buf.WriteRune(r)
-		r, _, _ = reader.ReadRune()
-	}
-	p.attr = buf.String()
-	return &p
-}
-
-// translate EscX to Meta+X
-func escapeKey(r rune, reader *bufio.Reader) rune {
-	switch r {
-	case 'b':
-		r = MetaBackward
-	case 'f':
-		r = MetaForward
-	case 'd':
-		r = MetaDelete
-	case CharTranspose:
-		r = MetaTranspose
-	case CharBackspace:
-		r = MetaBackspace
-	case 'O':
-		d, _, _ := reader.ReadRune()
-		switch d {
-		case 'H':
-			r = CharLineStart
-		case 'F':
-			r = CharLineEnd
-		default:
-			reader.UnreadRune()
-		}
-	case CharEsc:
-
-	}
-	return r
-}
-
-func SplitByLine(start, screenWidth int, rs []rune) []string {
-	var ret []string
-	buf := bytes.NewBuffer(nil)
-	currentWidth := start
-	for _, r := range rs {
-		w := runes.Width(r)
-		currentWidth += w
-		buf.WriteRune(r)
-		if currentWidth >= screenWidth {
-			ret = append(ret, buf.String())
-			buf.Reset()
-			currentWidth = 0
-		}
-	}
-	ret = append(ret, buf.String())
-	return ret
-}
-
-// calculate how many lines for N character
-func LineCount(screenWidth, w int) int {
-	r := w / screenWidth
-	if w%screenWidth != 0 {
-		r++
-	}
-	return r
-}
-
-func IsWordBreak(i rune) bool {
-	switch {
-	case i >= 'a' && i <= 'z':
-	case i >= 'A' && i <= 'Z':
-	case i >= '0' && i <= '9':
-	default:
-		return true
-	}
-	return false
-}
-
-func GetInt(s []string, def int) int {
-	if len(s) == 0 {
-		return def
-	}
-	c, err := strconv.Atoi(s[0])
-	if err != nil {
-		return def
-	}
-	return c
-}
-
-type RawMode struct {
-	state *State
-}
-
-func (r *RawMode) Enter() (err error) {
-	r.state, err = MakeRaw(GetStdin())
-	return err
-}
-
-func (r *RawMode) Exit() error {
-	if r.state == nil {
-		return nil
-	}
-	return Restore(GetStdin(), r.state)
-}
-
-// -----------------------------------------------------------------------------
-
-func sleep(n int) {
-	Debug(n)
-	time.Sleep(2000 * time.Millisecond)
-}
-
-// print a linked list to Debug()
-func debugList(l *list.List) {
-	idx := 0
-	for e := l.Front(); e != nil; e = e.Next() {
-		Debug(idx, fmt.Sprintf("%+v", e.Value))
-		idx++
-	}
-}
-
-// append log info to another file
-func Debug(o ...interface{}) {
-	f, _ := os.OpenFile("debug.tmp", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
-	fmt.Fprintln(f, o...)
-	f.Close()
-}
-
-func CaptureExitSignal(f func()) {
-	cSignal := make(chan os.Signal, 1)
-	signal.Notify(cSignal, os.Interrupt, syscall.SIGTERM)
-	go func() {
-		for range cSignal {
-			f()
-		}
-	}()
-}
diff --git a/vendor/github.com/chzyer/readline/utils_unix.go b/vendor/github.com/chzyer/readline/utils_unix.go
deleted file mode 100644
index fc49492..0000000
--- a/vendor/github.com/chzyer/readline/utils_unix.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// +build aix darwin dragonfly freebsd linux,!appengine netbsd openbsd os400 solaris
-
-package readline
-
-import (
-	"io"
-	"os"
-	"os/signal"
-	"sync"
-	"syscall"
-)
-
-type winsize struct {
-	Row    uint16
-	Col    uint16
-	Xpixel uint16
-	Ypixel uint16
-}
-
-// SuspendMe use to send suspend signal to myself, when we in the raw mode.
-// For OSX it need to send to parent's pid
-// For Linux it need to send to myself
-func SuspendMe() {
-	p, _ := os.FindProcess(os.Getppid())
-	p.Signal(syscall.SIGTSTP)
-	p, _ = os.FindProcess(os.Getpid())
-	p.Signal(syscall.SIGTSTP)
-}
-
-// get width of the terminal
-func getWidth(stdoutFd int) int {
-	cols, _, err := GetSize(stdoutFd)
-	if err != nil {
-		return -1
-	}
-	return cols
-}
-
-func GetScreenWidth() int {
-	w := getWidth(syscall.Stdout)
-	if w < 0 {
-		w = getWidth(syscall.Stderr)
-	}
-	return w
-}
-
-// ClearScreen clears the console screen
-func ClearScreen(w io.Writer) (int, error) {
-	return w.Write([]byte("\033[H"))
-}
-
-func DefaultIsTerminal() bool {
-	return IsTerminal(syscall.Stdin) && (IsTerminal(syscall.Stdout) || IsTerminal(syscall.Stderr))
-}
-
-func GetStdin() int {
-	return syscall.Stdin
-}
-
-// -----------------------------------------------------------------------------
-
-var (
-	widthChange         sync.Once
-	widthChangeCallback func()
-)
-
-func DefaultOnWidthChanged(f func()) {
-	widthChangeCallback = f
-	widthChange.Do(func() {
-		ch := make(chan os.Signal, 1)
-		signal.Notify(ch, syscall.SIGWINCH)
-
-		go func() {
-			for {
-				_, ok := <-ch
-				if !ok {
-					break
-				}
-				widthChangeCallback()
-			}
-		}()
-	})
-}
diff --git a/vendor/github.com/chzyer/readline/utils_windows.go b/vendor/github.com/chzyer/readline/utils_windows.go
deleted file mode 100644
index 5bfa55d..0000000
--- a/vendor/github.com/chzyer/readline/utils_windows.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build windows
-
-package readline
-
-import (
-	"io"
-	"syscall"
-)
-
-func SuspendMe() {
-}
-
-func GetStdin() int {
-	return int(syscall.Stdin)
-}
-
-func init() {
-	isWindows = true
-}
-
-// get width of the terminal
-func GetScreenWidth() int {
-	info, _ := GetConsoleScreenBufferInfo()
-	if info == nil {
-		return -1
-	}
-	return int(info.dwSize.x)
-}
-
-// ClearScreen clears the console screen
-func ClearScreen(_ io.Writer) error {
-	return SetConsoleCursorPosition(&_COORD{0, 0})
-}
-
-func DefaultIsTerminal() bool {
-	return true
-}
-
-func DefaultOnWidthChanged(func()) {
-
-}
diff --git a/vendor/github.com/chzyer/readline/windows_api.go b/vendor/github.com/chzyer/readline/windows_api.go
deleted file mode 100644
index 63f4f7b..0000000
--- a/vendor/github.com/chzyer/readline/windows_api.go
+++ /dev/null
@@ -1,152 +0,0 @@
-// +build windows
-
-package readline
-
-import (
-	"reflect"
-	"syscall"
-	"unsafe"
-)
-
-var (
-	kernel = NewKernel()
-	stdout = uintptr(syscall.Stdout)
-	stdin  = uintptr(syscall.Stdin)
-)
-
-type Kernel struct {
-	SetConsoleCursorPosition,
-	SetConsoleTextAttribute,
-	FillConsoleOutputCharacterW,
-	FillConsoleOutputAttribute,
-	ReadConsoleInputW,
-	GetConsoleScreenBufferInfo,
-	GetConsoleCursorInfo,
-	GetStdHandle CallFunc
-}
-
-type short int16
-type word uint16
-type dword uint32
-type wchar uint16
-
-type _COORD struct {
-	x short
-	y short
-}
-
-func (c *_COORD) ptr() uintptr {
-	return uintptr(*(*int32)(unsafe.Pointer(c)))
-}
-
-const (
-	EVENT_KEY                = 0x0001
-	EVENT_MOUSE              = 0x0002
-	EVENT_WINDOW_BUFFER_SIZE = 0x0004
-	EVENT_MENU               = 0x0008
-	EVENT_FOCUS              = 0x0010
-)
-
-type _KEY_EVENT_RECORD struct {
-	bKeyDown          int32
-	wRepeatCount      word
-	wVirtualKeyCode   word
-	wVirtualScanCode  word
-	unicodeChar       wchar
-	dwControlKeyState dword
-}
-
-// KEY_EVENT_RECORD          KeyEvent;
-// MOUSE_EVENT_RECORD        MouseEvent;
-// WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
-// MENU_EVENT_RECORD         MenuEvent;
-// FOCUS_EVENT_RECORD        FocusEvent;
-type _INPUT_RECORD struct {
-	EventType word
-	Padding   uint16
-	Event     [16]byte
-}
-
-type _CONSOLE_SCREEN_BUFFER_INFO struct {
-	dwSize              _COORD
-	dwCursorPosition    _COORD
-	wAttributes         word
-	srWindow            _SMALL_RECT
-	dwMaximumWindowSize _COORD
-}
-
-type _SMALL_RECT struct {
-	left   short
-	top    short
-	right  short
-	bottom short
-}
-
-type _CONSOLE_CURSOR_INFO struct {
-	dwSize   dword
-	bVisible bool
-}
-
-type CallFunc func(u ...uintptr) error
-
-func NewKernel() *Kernel {
-	k := &Kernel{}
-	kernel32 := syscall.NewLazyDLL("kernel32.dll")
-	v := reflect.ValueOf(k).Elem()
-	t := v.Type()
-	for i := 0; i < t.NumField(); i++ {
-		name := t.Field(i).Name
-		f := kernel32.NewProc(name)
-		v.Field(i).Set(reflect.ValueOf(k.Wrap(f)))
-	}
-	return k
-}
-
-func (k *Kernel) Wrap(p *syscall.LazyProc) CallFunc {
-	return func(args ...uintptr) error {
-		var r0 uintptr
-		var e1 syscall.Errno
-		size := uintptr(len(args))
-		if len(args) <= 3 {
-			buf := make([]uintptr, 3)
-			copy(buf, args)
-			r0, _, e1 = syscall.Syscall(p.Addr(), size,
-				buf[0], buf[1], buf[2])
-		} else {
-			buf := make([]uintptr, 6)
-			copy(buf, args)
-			r0, _, e1 = syscall.Syscall6(p.Addr(), size,
-				buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
-			)
-		}
-
-		if int(r0) == 0 {
-			if e1 != 0 {
-				return error(e1)
-			} else {
-				return syscall.EINVAL
-			}
-		}
-		return nil
-	}
-
-}
-
-func GetConsoleScreenBufferInfo() (*_CONSOLE_SCREEN_BUFFER_INFO, error) {
-	t := new(_CONSOLE_SCREEN_BUFFER_INFO)
-	err := kernel.GetConsoleScreenBufferInfo(
-		stdout,
-		uintptr(unsafe.Pointer(t)),
-	)
-	return t, err
-}
-
-func GetConsoleCursorInfo() (*_CONSOLE_CURSOR_INFO, error) {
-	t := new(_CONSOLE_CURSOR_INFO)
-	err := kernel.GetConsoleCursorInfo(stdout, uintptr(unsafe.Pointer(t)))
-	return t, err
-}
-
-func SetConsoleCursorPosition(c *_COORD) error {
-	return kernel.SetConsoleCursorPosition(stdout, c.ptr())
-}
diff --git a/vendor/github.com/ergochat/readline/.check-gofmt.sh b/vendor/github.com/ergochat/readline/.check-gofmt.sh
new file mode 100644
index 0000000..07275f5
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/.check-gofmt.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# exclude vendor/
+SOURCES="*.go internal/ example/"
+
+if [ "$1" = "--fix" ]; then
+	exec gofmt -s -w $SOURCES
+fi
+
+if [ -n "$(gofmt -s -l $SOURCES)" ]; then
+	echo "Go code is not formatted correctly with \`gofmt -s\`:"
+	gofmt -s -d $SOURCES
+	exit 1
+fi
diff --git a/vendor/github.com/chzyer/readline/.gitignore b/vendor/github.com/ergochat/readline/.gitignore
similarity index 62%
rename from vendor/github.com/chzyer/readline/.gitignore
rename to vendor/github.com/ergochat/readline/.gitignore
index a3062be..bb0d601 100644
--- a/vendor/github.com/chzyer/readline/.gitignore
+++ b/vendor/github.com/ergochat/readline/.gitignore
@@ -1 +1,2 @@
 .vscode/*
+*.swp
diff --git a/vendor/github.com/chzyer/readline/LICENSE b/vendor/github.com/ergochat/readline/LICENSE
similarity index 100%
rename from vendor/github.com/chzyer/readline/LICENSE
rename to vendor/github.com/ergochat/readline/LICENSE
diff --git a/vendor/github.com/ergochat/readline/Makefile b/vendor/github.com/ergochat/readline/Makefile
new file mode 100644
index 0000000..295aee2
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/Makefile
@@ -0,0 +1,18 @@
+.PHONY: all test examples ci gofmt
+
+all: ci
+
+ci: test examples
+
+test:
+	go test -race ./...
+	go vet ./...
+	./.check-gofmt.sh
+
+examples:
+	GOOS=linux go build -o /dev/null example/readline-demo/readline-demo.go
+	GOOS=windows go build -o /dev/null example/readline-demo/readline-demo.go
+	GOOS=darwin go build -o /dev/null example/readline-demo/readline-demo.go
+
+gofmt:
+	./.check-gofmt.sh --fix
diff --git a/vendor/github.com/ergochat/readline/README.md b/vendor/github.com/ergochat/readline/README.md
new file mode 100644
index 0000000..2acf833
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/README.md
@@ -0,0 +1,47 @@
+readline
+========
+
+[![Godoc](https://godoc.org/github.com/ergochat/readline?status.svg)](https://godoc.org/github.com/ergochat/readline)
+
+This is a pure Go implementation of functionality comparable to [GNU Readline](https://en.wikipedia.org/wiki/GNU_Readline), i.e. line editing and command history for simple TUI programs.
+
+It is a fork of [chzyer/readline](https://github.com/chzyer/readline).
+
+* Relative to the upstream repository, it is actively maintained and has numerous bug fixes
+   - See our [changelog](docs/CHANGELOG.md) for details on fixes and improvements
+   - See our [migration guide](docs/MIGRATING.md) for advice on how to migrate from upstream
+* Relative to [x/term](https://pkg.go.dev/golang.org/x/term), it has more features (e.g. tab-completion)
+* In use by multiple projects: [gopass](https://github.com/gopasspw/gopass), [fq](https://github.com/wader/fq), and [ircdog](https://github.com/ergochat/ircdog)
+
+
+```go
+package main
+
+import (
+	"fmt"
+	"log"
+
+	"github.com/ergochat/readline"
+)
+
+func main() {
+	// see readline.NewFromConfig for advanced options:
+	rl, err := readline.New("> ")
+	if err != nil {
+		log.Fatal(err)
+	}
+	defer rl.Close()
+	log.SetOutput(rl.Stderr()) // redraw the prompt correctly after log output
+
+	for {
+		line, err := rl.ReadLine()
+		// `err` is either nil, io.EOF, readline.ErrInterrupt, or an unexpected
+		// condition in stdin:
+		if err != nil {
+			return
+		}
+		// `line` is returned without the terminating \n or CRLF:
+		fmt.Fprintf(rl, "you wrote: %s\n", line)
+	}
+}
+```
diff --git a/vendor/github.com/ergochat/readline/complete.go b/vendor/github.com/ergochat/readline/complete.go
new file mode 100644
index 0000000..d8dce8c
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/complete.go
@@ -0,0 +1,556 @@
+package readline
+
+import (
+	"bufio"
+	"bytes"
+	"fmt"
+	"strings"
+	"sync/atomic"
+
+	"github.com/ergochat/readline/internal/platform"
+	"github.com/ergochat/readline/internal/runes"
+)
+
+type AutoCompleter interface {
+	// Readline will pass the whole line and current offset to it
+	// Completer need to pass all the candidates, and how long they shared the same characters in line
+	// Example:
+	//   [go, git, git-shell, grep]
+	//   Do("g", 1) => ["o", "it", "it-shell", "rep"], 1
+	//   Do("gi", 2) => ["t", "t-shell"], 2
+	//   Do("git", 3) => ["", "-shell"], 3
+	Do(line []rune, pos int) (newLine [][]rune, length int)
+}
+
+type opCompleter struct {
+	w  *terminal
+	op *operation
+
+	inCompleteMode atomic.Uint32 // this is read asynchronously from wrapWriter
+	inSelectMode   bool
+
+	candidate         [][]rune // list of candidates
+	candidateSource   []rune   // buffer string when tab was pressed
+	candidateOff      int      // num runes in common from buf where candidate start
+	candidateChoice   int      // absolute index of the chosen candidate (indexing the candidate array which might not all display in current page)
+	candidateColNum   int      // num columns candidates take 0..wraps, 1 col, 2 cols etc.
+	candidateColWidth int      // width of candidate columns
+	linesAvail        int      // number of lines available below the user's prompt which could be used for rendering the completion
+	pageStartIdx      []int    // start index in the candidate array on each page (candidatePageStart[i] = absolute idx of the first candidate on page i)
+	curPage           int      // index of the current page
+}
+
+func newOpCompleter(w *terminal, op *operation) *opCompleter {
+	return &opCompleter{
+		w:  w,
+		op: op,
+	}
+}
+
+func (o *opCompleter) truncateBufferAfterLastEqual(completion []rune) {
+	bufRunes := o.op.buf.Runes()
+	for i := len(bufRunes) - 1; i >= 0; i-- {
+		if bufRunes[i] == '=' {
+			prefix := bufRunes[i+1:] // part after '=' in buffer
+			if len(prefix) > 0 && len(completion) >= len(prefix) && string(completion[:len(prefix)]) == string(prefix) {
+				o.op.buf.Set(bufRunes[:i+1]) // Keep content till '='
+			}
+			break
+		}
+	}
+}
+
+func (o *opCompleter) writeRunes(candidate []rune) {
+	selected := candidate
+	spaceFound := false
+	for idx, r := range candidate {
+		if r == ' ' {
+			spaceFound = true
+		}
+		if spaceFound && r == '(' {
+			o.truncateBufferAfterLastEqual(candidate[idx+1:])
+			selected = candidate[:idx]
+			break
+		}
+	}
+	o.op.buf.WriteRunes(selected)
+}
+
+func (o *opCompleter) doSelect() {
+	if len(o.candidate) == 1 {
+		o.writeRunes(o.candidate[0])
+		o.ExitCompleteMode(false)
+		return
+	}
+	o.nextCandidate()
+	o.CompleteRefresh()
+}
+
+// Convert absolute index of the chosen candidate to a page-relative index
+func (o *opCompleter) candidateChoiceWithinPage() int {
+	return o.candidateChoice - o.pageStartIdx[o.curPage]
+}
+
+// Given a page relative index of the chosen candidate, update the absolute index
+func (o *opCompleter) updateAbsolutechoice(choiceWithinPage int) {
+	o.candidateChoice = choiceWithinPage + o.pageStartIdx[o.curPage]
+}
+
+// Move selection to the next candidate, updating page if necessary
+// Note: we don't allow passing arbitrary offset to this function because, e.g.,
+// we don't have the 3rd page offset initialized when the user is just seeing the first page,
+// so we only allow users to navigate into the 2nd page but not to an arbirary page as a result
+// of calling this method
+func (o *opCompleter) nextCandidate() {
+	o.candidateChoice = (o.candidateChoice + 1) % len(o.candidate)
+	// Wrapping around
+	if o.candidateChoice == 0 {
+		o.curPage = 0
+		return
+	}
+	// Going to next page
+	if o.candidateChoice == o.pageStartIdx[o.curPage+1] {
+		o.curPage += 1
+	}
+}
+
+// Move selection to the next ith col in the current line, wrapping to the line start/end if needed
+func (o *opCompleter) nextCol(i int) {
+	// If o.candidateColNum == 1 or 0, there is only one col per line and this is a noop
+	if o.candidateColNum > 1 {
+		idxWithinPage := o.candidateChoiceWithinPage()
+		curLine := idxWithinPage / o.candidateColNum
+		offsetInLine := idxWithinPage % o.candidateColNum
+		nextOffset := offsetInLine + i
+		nextOffset %= o.candidateColNum
+		if nextOffset < 0 {
+			nextOffset += o.candidateColNum
+		}
+
+		nextIdxWithinPage := curLine*o.candidateColNum + nextOffset
+		o.updateAbsolutechoice(nextIdxWithinPage)
+	}
+}
+
+// Move selection to the line below
+func (o *opCompleter) nextLine() {
+	colNum := 1
+	if o.candidateColNum > 1 {
+		colNum = o.candidateColNum
+	}
+
+	idxWithinPage := o.candidateChoiceWithinPage()
+
+	idxWithinPage += colNum
+	if idxWithinPage >= o.getMatrixSize() {
+		idxWithinPage -= o.getMatrixSize()
+	} else if idxWithinPage >= o.numCandidateCurPage() {
+		idxWithinPage += colNum
+		idxWithinPage -= o.getMatrixSize()
+	}
+
+	o.updateAbsolutechoice(idxWithinPage)
+}
+
+// Move selection to the line above
+func (o *opCompleter) prevLine() {
+	colNum := 1
+	if o.candidateColNum > 1 {
+		colNum = o.candidateColNum
+	}
+
+	idxWithinPage := o.candidateChoiceWithinPage()
+
+	idxWithinPage -= colNum
+	if idxWithinPage < 0 {
+		idxWithinPage += o.getMatrixSize()
+		if idxWithinPage >= o.numCandidateCurPage() {
+			idxWithinPage -= colNum
+		}
+	}
+
+	o.updateAbsolutechoice(idxWithinPage)
+}
+
+// Move selection to the start of the current line
+func (o *opCompleter) lineStart() {
+	if o.candidateColNum > 1 {
+		idxWithinPage := o.candidateChoiceWithinPage()
+		lineOffset := idxWithinPage % o.candidateColNum
+		idxWithinPage -= lineOffset
+		o.updateAbsolutechoice(idxWithinPage)
+	}
+}
+
+// Move selection to the end of the current line
+func (o *opCompleter) lineEnd() {
+	if o.candidateColNum > 1 {
+		idxWithinPage := o.candidateChoiceWithinPage()
+		offsetToLineEnd := o.candidateColNum - idxWithinPage%o.candidateColNum - 1
+		idxWithinPage += offsetToLineEnd
+		o.updateAbsolutechoice(idxWithinPage)
+		if o.candidateChoice >= len(o.candidate) {
+			o.candidateChoice = len(o.candidate) - 1
+		}
+	}
+}
+
+// Move to the next page if possible, returning selection to the first item in the page
+func (o *opCompleter) nextPage() {
+	// Check that this is not the last page already
+	nextPageStart := o.pageStartIdx[o.curPage+1]
+	if nextPageStart < len(o.candidate) {
+		o.curPage += 1
+		o.candidateChoice = o.pageStartIdx[o.curPage]
+	}
+}
+
+// Move to the previous page if possible, returning selection to the first item in the page
+func (o *opCompleter) prevPage() {
+	if o.curPage > 0 {
+		o.curPage -= 1
+		o.candidateChoice = o.pageStartIdx[o.curPage]
+	}
+}
+
+// OnComplete returns true if complete mode is available. Used to ring bell
+// when tab pressed if cannot do complete for reason such as width unknown
+// or no candidates available.
+func (o *opCompleter) OnComplete() (ringBell bool) {
+	tWidth, tHeight := o.w.GetWidthHeight()
+	if tWidth == 0 || tHeight < 3 {
+		return false
+	}
+	if o.IsInCompleteSelectMode() {
+		o.doSelect()
+		return true
+	}
+
+	buf := o.op.buf
+	rs := buf.Runes()
+
+	// If in complete mode and nothing else typed then we must be entering select mode
+	if o.IsInCompleteMode() && o.candidateSource != nil && runes.Equal(rs, o.candidateSource) {
+		if len(o.candidate) > 1 {
+			same, size := runes.Aggregate(o.candidate)
+			if size > 0 {
+				buf.WriteRunes(same)
+				o.ExitCompleteMode(false)
+				return false // partial completion so ring the bell
+			}
+		}
+		o.EnterCompleteSelectMode()
+		o.doSelect()
+		return true
+	}
+
+	newLines, offset := o.op.GetConfig().AutoComplete.Do(rs, buf.idx)
+	if len(newLines) == 0 || (len(newLines) == 1 && len(newLines[0]) == 0) {
+		o.ExitCompleteMode(false)
+		return false // will ring bell on initial tab press
+	}
+	if o.candidateOff > offset {
+		// part of buffer we are completing has changed. Example might be that we were completing "ls" and
+		// user typed space so we are no longer completing "ls" but now we are completing an argument of
+		// the ls command. Instead of continuing in complete mode, we exit.
+		o.ExitCompleteMode(false)
+		return true
+	}
+	o.candidateSource = rs
+
+	// only Aggregate candidates in non-complete mode
+	if !o.IsInCompleteMode() {
+		if len(newLines) == 1 {
+			// not yet in complete mode but only 1 candidate so complete it
+			o.writeRunes(newLines[0])
+			o.ExitCompleteMode(false)
+			return true
+		}
+
+		// check if all candidates have common prefix and return it and its size
+		same, size := runes.Aggregate(newLines)
+		if size > 0 {
+			buf.WriteRunes(same)
+			o.ExitCompleteMode(false)
+			return false // partial completion so ring the bell
+		}
+	}
+
+	// otherwise, we just enter complete mode (which does a refresh)
+	o.EnterCompleteMode(offset, newLines)
+	return true
+}
+
+func (o *opCompleter) IsInCompleteSelectMode() bool {
+	return o.inSelectMode
+}
+
+func (o *opCompleter) IsInCompleteMode() bool {
+	return o.inCompleteMode.Load() == 1
+}
+
+func (o *opCompleter) HandleCompleteSelect(r rune) (stayInMode bool) {
+	next := true
+	switch r {
+	case CharEnter, CharCtrlJ:
+		next = false
+		o.writeRunes(o.candidate[o.candidateChoice])
+		o.ExitCompleteMode(false)
+	case CharLineStart:
+		o.lineStart()
+	case CharLineEnd:
+		o.lineEnd()
+	case CharBackspace:
+		o.ExitCompleteSelectMode()
+		next = false
+	case CharTab:
+		o.nextCandidate()
+	case CharForward:
+		o.nextCol(1)
+	case CharBell, CharInterrupt:
+		o.ExitCompleteMode(true)
+		next = false
+	case CharNext:
+		o.nextLine()
+	case CharBackward, MetaShiftTab:
+		o.nextCol(-1)
+	case CharPrev:
+		o.prevLine()
+	case 'j', 'J':
+		o.prevPage()
+	case 'k', 'K':
+		o.nextPage()
+	default:
+		next = false
+		o.ExitCompleteSelectMode()
+	}
+	if next {
+		o.CompleteRefresh()
+		return true
+	}
+	return false
+}
+
+func (o *opCompleter) getMatrixSize() int {
+	colNum := 1
+	if o.candidateColNum > 1 {
+		colNum = o.candidateColNum
+	}
+	line := o.getMatrixNumRows()
+	return line * colNum
+}
+
+// Number of candidate that could fit on current page
+func (o *opCompleter) numCandidateCurPage() int {
+	// Safety: we will always render the first page, and whenever we finished rendering page i,
+	// we always populate o.candidatePageStart through at least i + 1, so when this is called, we
+	// always know the start of the next page
+	return o.pageStartIdx[o.curPage+1] - o.pageStartIdx[o.curPage]
+}
+
+// Get number of rows of current page viewed as a matrix of candidates
+func (o *opCompleter) getMatrixNumRows() int {
+	candidateCurPage := o.numCandidateCurPage()
+	// Normal case where there is no wrap
+	if o.candidateColNum > 1 {
+		numLine := candidateCurPage / o.candidateColNum
+		if candidateCurPage%o.candidateColNum != 0 {
+			numLine++
+		}
+		return numLine
+	}
+
+	// Now since there are wraps, each candidate will be put on its own line, so the number of lines is just the number of candidate
+	return candidateCurPage
+}
+
+// setColumnInfo calculates column width and number of columns required
+// to present the list of candidates on the terminal.
+func (o *opCompleter) setColumnInfo() {
+	same := o.op.buf.RuneSlice(-o.candidateOff)
+	sameWidth := runes.WidthAll(same)
+
+	colWidth := 0
+	for _, c := range o.candidate {
+		w := sameWidth + runes.WidthAll(c)
+		if w > colWidth {
+			colWidth = w
+		}
+	}
+	colWidth++ // whitespace between cols
+
+	tWidth, _ := o.w.GetWidthHeight()
+
+	// -1 to avoid end of line issues
+	width := tWidth - 1
+	colNum := width / colWidth
+	if colNum != 0 {
+		colWidth += (width - (colWidth * colNum)) / colNum
+	}
+
+	o.candidateColNum = colNum
+	o.candidateColWidth = colWidth
+}
+
+// CompleteRefresh is used for completemode and selectmode
+func (o *opCompleter) CompleteRefresh() {
+	if !o.IsInCompleteMode() {
+		return
+	}
+
+	buf := bufio.NewWriter(o.w)
+	// calculate num lines from cursor pos to where choices should be written
+	lineCnt := o.op.buf.CursorLineCount()
+	buf.Write(bytes.Repeat([]byte("\n"), lineCnt)) // move down from cursor to start of candidates
+	buf.WriteString("\033[J")
+
+	same := o.op.buf.RuneSlice(-o.candidateOff)
+	tWidth, _ := o.w.GetWidthHeight()
+
+	colIdx := 0
+	lines := 0
+	sameWidth := runes.WidthAll(same)
+
+	// Show completions for the current page
+	idx := o.pageStartIdx[o.curPage]
+	for ; idx < len(o.candidate); idx++ {
+		// If writing the current candidate would overflow the page,
+		// we know that it is the start of the next page.
+		if colIdx == 0 && lines == o.linesAvail {
+			if o.curPage == len(o.pageStartIdx)-1 {
+				o.pageStartIdx = append(o.pageStartIdx, idx)
+			}
+			break
+		}
+
+		c := o.candidate[idx]
+		inSelect := idx == o.candidateChoice && o.IsInCompleteSelectMode()
+		cWidth := sameWidth + runes.WidthAll(c)
+		cLines := 1
+		if tWidth > 0 {
+			sWidth := 0
+			if platform.IsWindows && inSelect {
+				sWidth = 1 // adjust for hightlighting on Windows
+			}
+			cLines = (cWidth + sWidth) / tWidth
+			if (cWidth+sWidth)%tWidth > 0 {
+				cLines++
+			}
+		}
+
+		if lines > 0 && colIdx == 0 {
+			// After line 1, if we're printing to the first column
+			// goto a new line. We do it here, instead of at the end
+			// of the loop, to avoid the last \n taking up a blank
+			// line at the end and stealing realestate.
+			buf.WriteString("\n")
+		}
+
+		if inSelect {
+			buf.WriteString("\033[30;47m")
+		}
+
+		buf.WriteString(string(same))
+		buf.WriteString(string(c))
+		if o.candidateColNum >= 1 {
+			// only output spaces between columns if everything fits
+			buf.Write(bytes.Repeat([]byte(" "), o.candidateColWidth-cWidth))
+		}
+
+		if inSelect {
+			buf.WriteString("\033[0m")
+		}
+
+		colIdx++
+		if colIdx >= o.candidateColNum {
+			lines += cLines
+			colIdx = 0
+			if platform.IsWindows {
+				// Windows EOL edge-case.
+				buf.WriteString("\b")
+			}
+		}
+	}
+
+	if idx == len(o.candidate) {
+		// Book-keeping for the last page.
+		o.pageStartIdx = append(o.pageStartIdx, len(o.candidate))
+	}
+
+	if colIdx > 0 {
+		lines++ // mid-line so count it.
+	}
+
+	// Show the guidance if there are more pages
+	if idx != len(o.candidate) || o.curPage > 0 {
+		buf.WriteString("\n-- (j: prev page) (k: next page) --")
+		lines++
+	}
+
+	// wrote out choices over "lines", move back to cursor (positioned at index)
+	fmt.Fprintf(buf, "\033[%dA", lines)
+
+	// Redraw the prompt and buffer since \033[J may have cleared them
+	// Calculate which line the cursor is on (0-indexed, where 0 is the prompt line)
+	cursorLine := o.op.buf.IdxLine(tWidth)
+
+	// Move to the beginning of the prompt line (line 0)
+	if cursorLine > 0 {
+		fmt.Fprintf(buf, "\033[%dA", cursorLine)
+	}
+	// Move to column 1 to redraw from the start
+	buf.WriteString("\033[1G")
+	// Redraw prompt and buffer content
+	cfg := o.op.GetConfig()
+	buf.WriteString(cfg.Prompt)
+	buf.WriteString("\x1b[0K") // Clear line from cursor right
+	rs := o.op.buf.Runes()
+	for _, e := range cfg.Painter(rs, o.op.buf.Pos()) {
+		if e == '\t' {
+			buf.WriteString(strings.Repeat(" ", runes.TabWidth))
+		} else {
+			buf.WriteRune(e)
+		}
+	}
+	// Now position cursor correctly - move back down to the cursor line
+	if cursorLine > 0 {
+		fmt.Fprintf(buf, "\033[%dB", cursorLine)
+	}
+	buf.Write(o.op.buf.getBackspaceSequence())
+	buf.Flush()
+}
+
+func (o *opCompleter) EnterCompleteSelectMode() {
+	o.inSelectMode = true
+	o.candidateChoice = -1
+}
+
+func (o *opCompleter) EnterCompleteMode(offset int, candidate [][]rune) {
+	o.inCompleteMode.Store(1)
+	o.candidate = candidate
+	o.candidateOff = offset
+	o.setColumnInfo()
+	o.initPage()
+	o.CompleteRefresh()
+}
+
+func (o *opCompleter) initPage() {
+	_, tHeight := o.w.GetWidthHeight()
+	buflineCnt := o.op.buf.LineCount()      // lines taken by buffer content
+	o.linesAvail = tHeight - buflineCnt - 1 // lines available without scrolling buffer off screen, reserve one line for the guidance message
+	o.pageStartIdx = []int{0}               // first page always start at 0
+	o.curPage = 0
+}
+
+func (o *opCompleter) ExitCompleteSelectMode() {
+	o.inSelectMode = false
+	o.candidateChoice = -1
+}
+
+func (o *opCompleter) ExitCompleteMode(revent bool) {
+	o.inCompleteMode.Store(0)
+	o.candidate = nil
+	o.candidateOff = -1
+	o.candidateSource = nil
+	o.ExitCompleteSelectMode()
+}
diff --git a/vendor/github.com/ergochat/readline/complete_helper.go b/vendor/github.com/ergochat/readline/complete_helper.go
new file mode 100644
index 0000000..a8e0200
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/complete_helper.go
@@ -0,0 +1,156 @@
+package readline
+
+import (
+	"bytes"
+	"strings"
+
+	"github.com/ergochat/readline/internal/runes"
+)
+
+// PrefixCompleter implements AutoCompleter via a recursive tree.
+type PrefixCompleter struct {
+	// Name is the name of a command, subcommand, or argument eligible for completion.
+	Name string
+	// Callback is optional; if defined, it takes the current line and returns
+	// a list of possible completions associated with the current node (i.e.
+	// in place of Name).
+	Callback func(string) []string
+	// Children is a list of possible completions that can follow the current node.
+	Children []*PrefixCompleter
+
+	nameRunes []rune // just a cache
+}
+
+var _ AutoCompleter = (*PrefixCompleter)(nil)
+
+func (p *PrefixCompleter) Tree(prefix string) string {
+	buf := bytes.NewBuffer(nil)
+	p.print(prefix, 0, buf)
+	return buf.String()
+}
+
+func prefixPrint(p *PrefixCompleter, prefix string, level int, buf *bytes.Buffer) {
+	if strings.TrimSpace(p.Name) != "" {
+		buf.WriteString(prefix)
+		if level > 0 {
+			buf.WriteString("├")
+			buf.WriteString(strings.Repeat("─", (level*4)-2))
+			buf.WriteString(" ")
+		}
+		buf.WriteString(p.Name)
+		buf.WriteByte('\n')
+		level++
+	}
+	for _, ch := range p.Children {
+		ch.print(prefix, level, buf)
+	}
+}
+
+func (p *PrefixCompleter) print(prefix string, level int, buf *bytes.Buffer) {
+	prefixPrint(p, prefix, level, buf)
+}
+
+func (p *PrefixCompleter) getName() []rune {
+	if p.nameRunes == nil {
+		if p.Name != "" {
+			p.nameRunes = []rune(p.Name)
+		} else {
+			p.nameRunes = make([]rune, 0)
+		}
+	}
+	return p.nameRunes
+}
+
+func (p *PrefixCompleter) getDynamicNames(line []rune) [][]rune {
+	var result [][]rune
+	for _, name := range p.Callback(string(line)) {
+		nameRunes := []rune(name)
+		nameRunes = append(nameRunes, ' ')
+		result = append(result, nameRunes)
+	}
+	return result
+}
+
+func (p *PrefixCompleter) SetChildren(children []*PrefixCompleter) {
+	p.Children = children
+}
+
+func NewPrefixCompleter(pc ...*PrefixCompleter) *PrefixCompleter {
+	return PcItem("", pc...)
+}
+
+func PcItem(name string, pc ...*PrefixCompleter) *PrefixCompleter {
+	name += " "
+	result := &PrefixCompleter{
+		Name:     name,
+		Children: pc,
+	}
+	result.getName() // initialize nameRunes member
+	return result
+}
+
+func PcItemDynamic(callback func(string) []string, pc ...*PrefixCompleter) *PrefixCompleter {
+	return &PrefixCompleter{
+		Callback: callback,
+		Children: pc,
+	}
+}
+
+func (p *PrefixCompleter) Do(line []rune, pos int) (newLine [][]rune, offset int) {
+	return doInternal(p, line, pos, line)
+}
+
+func doInternal(p *PrefixCompleter, line []rune, pos int, origLine []rune) (newLine [][]rune, offset int) {
+	line = runes.TrimSpaceLeft(line[:pos])
+	goNext := false
+	var lineCompleter *PrefixCompleter
+	for _, child := range p.Children {
+		var childNames [][]rune
+		if child.Callback != nil {
+			childNames = child.getDynamicNames(origLine)
+		} else {
+			childNames = make([][]rune, 1)
+			childNames[0] = child.getName()
+		}
+
+		for _, childName := range childNames {
+			if len(line) >= len(childName) {
+				if runes.HasPrefix(line, childName) {
+					if len(line) == len(childName) {
+						newLine = append(newLine, []rune{' '})
+					} else {
+						newLine = append(newLine, childName)
+					}
+					offset = len(childName)
+					lineCompleter = child
+					goNext = true
+				}
+			} else {
+				if runes.HasPrefix(childName, line) {
+					newLine = append(newLine, childName[len(line):])
+					offset = len(line)
+					lineCompleter = child
+				}
+			}
+		}
+	}
+
+	if len(newLine) != 1 {
+		return
+	}
+
+	tmpLine := make([]rune, 0, len(line))
+	for i := offset; i < len(line); i++ {
+		if line[i] == ' ' {
+			continue
+		}
+
+		tmpLine = append(tmpLine, line[i:]...)
+		return doInternal(lineCompleter, tmpLine, len(tmpLine), origLine)
+	}
+
+	if goNext {
+		return doInternal(lineCompleter, nil, 0, origLine)
+	}
+	return
+}
diff --git a/vendor/github.com/chzyer/readline/history.go b/vendor/github.com/ergochat/readline/history.go
similarity index 82%
rename from vendor/github.com/chzyer/readline/history.go
rename to vendor/github.com/ergochat/readline/history.go
index 6b17c46..45ac509 100644
--- a/vendor/github.com/chzyer/readline/history.go
+++ b/vendor/github.com/ergochat/readline/history.go
@@ -7,6 +7,8 @@ import (
 	"os"
 	"strings"
 	"sync"
+
+	"github.com/ergochat/readline/internal/runes"
 )
 
 type hisItem struct {
@@ -21,7 +23,7 @@ func (h *hisItem) Clean() {
 }
 
 type opHistory struct {
-	cfg        *Config
+	operation  *operation
 	history    *list.List
 	historyVer int64
 	current    *list.Element
@@ -30,43 +32,37 @@ type opHistory struct {
 	enable     bool
 }
 
-func newOpHistory(cfg *Config) (o *opHistory) {
+func newOpHistory(operation *operation) (o *opHistory) {
 	o = &opHistory{
-		cfg:     cfg,
-		history: list.New(),
-		enable:  true,
+		operation: operation,
+		history:   list.New(),
+		enable:    true,
 	}
+	o.initHistory()
 	return o
 }
 
+func (o *opHistory) isEnabled() bool {
+	return o.enable && o.operation.GetConfig().HistoryLimit > 0
+}
+
 func (o *opHistory) Reset() {
 	o.history = list.New()
 	o.current = nil
 }
 
-func (o *opHistory) IsHistoryClosed() bool {
-	o.fdLock.Lock()
-	defer o.fdLock.Unlock()
-	return o.fd.Fd() == ^(uintptr(0))
-}
-
-func (o *opHistory) Init() {
-	if o.IsHistoryClosed() {
-		o.initHistory()
-	}
-}
-
 func (o *opHistory) initHistory() {
-	if o.cfg.HistoryFile != "" {
-		o.historyUpdatePath(o.cfg.HistoryFile)
+	cfg := o.operation.GetConfig()
+	if cfg.HistoryFile != "" {
+		o.historyUpdatePath(cfg)
 	}
 }
 
 // only called by newOpHistory
-func (o *opHistory) historyUpdatePath(path string) {
+func (o *opHistory) historyUpdatePath(cfg *Config) {
 	o.fdLock.Lock()
 	defer o.fdLock.Unlock()
-	f, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
+	f, err := os.OpenFile(cfg.HistoryFile, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
 	if err != nil {
 		return
 	}
@@ -86,7 +82,7 @@ func (o *opHistory) historyUpdatePath(path string) {
 		o.Push([]rune(line))
 		o.Compact()
 	}
-	if total > o.cfg.HistoryLimit {
+	if total > cfg.HistoryLimit {
 		o.rewriteLocked()
 	}
 	o.historyVer++
@@ -95,7 +91,8 @@ func (o *opHistory) historyUpdatePath(path string) {
 }
 
 func (o *opHistory) Compact() {
-	for o.history.Len() > o.cfg.HistoryLimit && o.history.Len() > 0 {
+	cfg := o.operation.GetConfig()
+	for o.history.Len() > cfg.HistoryLimit && o.history.Len() > 0 {
 		o.history.Remove(o.history.Front())
 	}
 }
@@ -107,11 +104,12 @@ func (o *opHistory) Rewrite() {
 }
 
 func (o *opHistory) rewriteLocked() {
-	if o.cfg.HistoryFile == "" {
+	cfg := o.operation.GetConfig()
+	if cfg.HistoryFile == "" {
 		return
 	}
 
-	tmpFile := o.cfg.HistoryFile + ".tmp"
+	tmpFile := cfg.HistoryFile + ".tmp"
 	fd, err := os.OpenFile(tmpFile, os.O_CREATE|os.O_WRONLY|os.O_TRUNC|os.O_APPEND, 0666)
 	if err != nil {
 		return
@@ -124,7 +122,7 @@ func (o *opHistory) rewriteLocked() {
 	buf.Flush()
 
 	// replace history file
-	if err = os.Rename(tmpFile, o.cfg.HistoryFile); err != nil {
+	if err = os.Rename(tmpFile, cfg.HistoryFile); err != nil {
 		fd.Close()
 		return
 	}
@@ -155,7 +153,7 @@ func (o *opHistory) FindBck(isNewSearch bool, rs []rune, start int) (int, *list.
 				item = item[:start]
 			}
 		}
-		idx := runes.IndexAllBckEx(item, rs, o.cfg.HistorySearchFold)
+		idx := runes.IndexAllBckEx(item, rs, o.operation.GetConfig().HistorySearchFold)
 		if idx < 0 {
 			continue
 		}
@@ -180,7 +178,7 @@ func (o *opHistory) FindFwd(isNewSearch bool, rs []rune, start int) (int, *list.
 				continue
 			}
 		}
-		idx := runes.IndexAllEx(item, rs, o.cfg.HistorySearchFold)
+		idx := runes.IndexAllEx(item, rs, o.operation.GetConfig().HistorySearchFold)
 		if idx < 0 {
 			continue
 		}
@@ -236,17 +234,15 @@ func (o *opHistory) Enable() {
 }
 
 func (o *opHistory) debug() {
-	Debug("-------")
+	debugPrint("-------")
 	for item := o.history.Front(); item != nil; item = item.Next() {
-		Debug(fmt.Sprintf("%+v", item.Value))
+		debugPrint(fmt.Sprintf("%+v", item.Value))
 	}
 }
 
 // save history
 func (o *opHistory) New(current []rune) (err error) {
-
-	// history deactivated
-	if !o.enable {
+	if !o.isEnabled() {
 		return nil
 	}
 
@@ -299,6 +295,10 @@ func (o *opHistory) Revert() {
 }
 
 func (o *opHistory) Update(s []rune, commit bool) (err error) {
+	if !o.isEnabled() {
+		return nil
+	}
+
 	o.fdLock.Lock()
 	defer o.fdLock.Unlock()
 	s = runes.Copy(s)
diff --git a/vendor/github.com/ergochat/readline/internal/ansi/ansi.go b/vendor/github.com/ergochat/readline/internal/ansi/ansi.go
new file mode 100644
index 0000000..762a4ec
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/ansi/ansi.go
@@ -0,0 +1,7 @@
+//go:build !windows
+
+package ansi
+
+func EnableANSI() error {
+	return nil
+}
diff --git a/vendor/github.com/ergochat/readline/internal/ansi/ansi_windows.go b/vendor/github.com/ergochat/readline/internal/ansi/ansi_windows.go
new file mode 100644
index 0000000..56c903d
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/ansi/ansi_windows.go
@@ -0,0 +1,85 @@
+//go:build windows
+
+/*
+Copyright (c) Jason Walton <de...@lucid.thedremaing.org> (https://www.thedreaming.org)
+Copyright (c) Sindre Sorhus <si...@gmail.com> (https://sindresorhus.com)
+
+Released under the MIT License:
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+package ansi
+
+import (
+	"sync"
+
+	"golang.org/x/sys/windows"
+)
+
+var (
+	ansiErr  error
+	ansiOnce sync.Once
+)
+
+func EnableANSI() error {
+	ansiOnce.Do(func() {
+		ansiErr = realEnableANSI()
+	})
+	return ansiErr
+}
+
+func realEnableANSI() error {
+	// We want to enable the following modes, if they are not already set:
+	// ENABLE_VIRTUAL_TERMINAL_PROCESSING on stdout (color support)
+	// ENABLE_VIRTUAL_TERMINAL_INPUT on stdin (ansi input sequences)
+	// See https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
+	if err := windowsSetMode(windows.STD_OUTPUT_HANDLE, windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING); err != nil {
+		return err
+	}
+	if err := windowsSetMode(windows.STD_INPUT_HANDLE, windows.ENABLE_VIRTUAL_TERMINAL_INPUT); err != nil {
+		return err
+	}
+	return nil
+}
+
+func windowsSetMode(stdhandle uint32, modeFlag uint32) (err error) {
+	handle, err := windows.GetStdHandle(stdhandle)
+	if err != nil {
+		return err
+	}
+
+	// Get the existing console mode.
+	var mode uint32
+	err = windows.GetConsoleMode(handle, &mode)
+	if err != nil {
+		return err
+	}
+
+	// Enable the mode if it is not currently set
+	if mode&modeFlag != modeFlag {
+		mode = mode | modeFlag
+		err = windows.SetConsoleMode(handle, mode)
+		if err != nil {
+			return err
+		}
+	}
+
+	return nil
+}
diff --git a/vendor/github.com/ergochat/readline/internal/platform/utils_unix.go b/vendor/github.com/ergochat/readline/internal/platform/utils_unix.go
new file mode 100644
index 0000000..1e0795d
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/platform/utils_unix.go
@@ -0,0 +1,83 @@
+//go:build aix || darwin || dragonfly || freebsd || (linux && !appengine) || netbsd || openbsd || os400 || solaris || zos
+
+package platform
+
+import (
+	"context"
+	"os"
+	"os/signal"
+	"sync"
+	"syscall"
+
+	"github.com/ergochat/readline/internal/term"
+)
+
+const (
+	IsWindows = false
+)
+
+// SuspendProcess suspends the process with SIGTSTP,
+// then blocks until it is resumed.
+func SuspendProcess() {
+	ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGCONT)
+	defer stop()
+
+	p, err := os.FindProcess(os.Getpid())
+	if err != nil {
+		panic(err)
+	}
+	p.Signal(syscall.SIGTSTP)
+	// wait for SIGCONT
+	<-ctx.Done()
+}
+
+// getWidthHeight of the terminal using given file descriptor
+func getWidthHeight(stdoutFd int) (width int, height int) {
+	width, height, err := term.GetSize(stdoutFd)
+	if err != nil {
+		return -1, -1
+	}
+	return
+}
+
+// GetScreenSize returns the width/height of the terminal or -1,-1 or error
+func GetScreenSize() (width int, height int) {
+	width, height = getWidthHeight(syscall.Stdout)
+	if width < 0 {
+		width, height = getWidthHeight(syscall.Stderr)
+	}
+	return
+}
+
+func DefaultIsTerminal() bool {
+	return term.IsTerminal(syscall.Stdin) && (term.IsTerminal(syscall.Stdout) || term.IsTerminal(syscall.Stderr))
+}
+
+// -----------------------------------------------------------------------------
+
+var (
+	sizeChange         sync.Once
+	sizeChangeCallback func()
+)
+
+func DefaultOnWidthChanged(f func()) {
+	DefaultOnSizeChanged(f)
+}
+
+func DefaultOnSizeChanged(f func()) {
+	sizeChangeCallback = f
+	sizeChange.Do(func() {
+		ch := make(chan os.Signal, 1)
+		signal.Notify(ch, syscall.SIGWINCH)
+
+		go func() {
+			for {
+				_, ok := <-ch
+				if !ok {
+					break
+				}
+				sizeChangeCallback()
+			}
+		}()
+	})
+}
diff --git a/vendor/github.com/ergochat/readline/internal/platform/utils_windows.go b/vendor/github.com/ergochat/readline/internal/platform/utils_windows.go
new file mode 100644
index 0000000..8ddc88a
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/platform/utils_windows.go
@@ -0,0 +1,38 @@
+//go:build windows
+
+package platform
+
+import (
+	"syscall"
+
+	"github.com/ergochat/readline/internal/term"
+)
+
+const (
+	IsWindows = true
+)
+
+func SuspendProcess() {
+}
+
+// GetScreenSize returns the width, height of the terminal or -1,-1
+func GetScreenSize() (width int, height int) {
+	width, height, err := term.GetSize(int(syscall.Stdout))
+	if err == nil {
+		return width, height
+	} else {
+		return 0, 0
+	}
+}
+
+func DefaultIsTerminal() bool {
+	return term.IsTerminal(int(syscall.Stdin)) && term.IsTerminal(int(syscall.Stdout))
+}
+
+func DefaultOnWidthChanged(f func()) {
+	DefaultOnSizeChanged(f)
+}
+
+func DefaultOnSizeChanged(f func()) {
+	// TODO: does Windows have a SIGWINCH analogue?
+}
diff --git a/vendor/github.com/ergochat/readline/internal/ringbuf/ringbuf.go b/vendor/github.com/ergochat/readline/internal/ringbuf/ringbuf.go
new file mode 100644
index 0000000..9d37561
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/ringbuf/ringbuf.go
@@ -0,0 +1,222 @@
+// Copyright (c) 2023 Shivaram Lingamneni <sl...@cs.stanford.edu>
+// released under the MIT license
+
+package ringbuf
+
+type Buffer[T any] struct {
+	// three possible states:
+	// empty: start == end == -1
+	// partially full: start != end
+	// full: start == end > 0
+	// if entries exist, they go from `start` to `(end - 1) % length`
+	buffer      []T
+	start       int
+	end         int
+	maximumSize int
+}
+
+func NewExpandableBuffer[T any](initialSize, maximumSize int) (result *Buffer[T]) {
+	result = new(Buffer[T])
+	result.Initialize(initialSize, maximumSize)
+	return
+}
+
+func (hist *Buffer[T]) Initialize(initialSize, maximumSize int) {
+	if maximumSize == 0 {
+		panic("maximum size cannot be 0")
+	}
+	hist.buffer = make([]T, initialSize)
+	hist.start = -1
+	hist.end = -1
+	hist.maximumSize = maximumSize
+}
+
+// Add adds an item to the buffer
+func (list *Buffer[T]) Add(item T) {
+	list.maybeExpand()
+
+	var pos int
+	if list.start == -1 { // empty
+		pos = 0
+		list.start = 0
+		list.end = 1 % len(list.buffer)
+	} else if list.start != list.end { // partially full
+		pos = list.end
+		list.end = (list.end + 1) % len(list.buffer)
+	} else if list.start == list.end { // full
+		pos = list.end
+		list.end = (list.end + 1) % len(list.buffer)
+		list.start = list.end // advance start as well, overwriting first entry
+	}
+
+	list.buffer[pos] = item
+}
+
+func (list *Buffer[T]) Pop() (item T, success bool) {
+	length := list.Length()
+	if length == 0 {
+		return item, false
+	} else {
+		pos := list.prev(list.end)
+		item = list.buffer[pos]
+		list.buffer[pos] = *new(T) // TODO verify that this doesn't allocate
+		if length > 1 {
+			list.end = pos
+		} else {
+			// reset to empty buffer
+			list.start = -1
+			list.end = -1
+		}
+		return item, true
+	}
+}
+
+func (list *Buffer[T]) Range(ascending bool, rangeFunction func(item *T) (stopIteration bool)) {
+	if list.start == -1 || len(list.buffer) == 0 {
+		return
+	}
+
+	var pos, stop int
+	if ascending {
+		pos = list.start
+		stop = list.prev(list.end)
+	} else {
+		pos = list.prev(list.end)
+		stop = list.start
+	}
+
+	for {
+		if shouldStop := rangeFunction(&list.buffer[pos]); shouldStop {
+			return
+		}
+
+		if pos == stop {
+			return
+		}
+
+		if ascending {
+			pos = list.next(pos)
+		} else {
+			pos = list.prev(pos)
+		}
+	}
+}
+
+type Predicate[T any] func(item *T) (matches bool)
+
+func (list *Buffer[T]) Match(ascending bool, predicate Predicate[T], limit int) []T {
+	var results []T
+	rangeFunc := func(item *T) (stopIteration bool) {
+		if predicate(item) {
+			results = append(results, *item)
+			return limit > 0 && len(results) >= limit
+		} else {
+			return false
+		}
+	}
+	list.Range(ascending, rangeFunc)
+	return results
+}
+
+func (list *Buffer[T]) prev(index int) int {
+	switch index {
+	case 0:
+		return len(list.buffer) - 1
+	default:
+		return index - 1
+	}
+}
+
+func (list *Buffer[T]) next(index int) int {
+	switch index {
+	case len(list.buffer) - 1:
+		return 0
+	default:
+		return index + 1
+	}
+}
+
+func (list *Buffer[T]) maybeExpand() {
+	length := list.Length()
+	if length < len(list.buffer) {
+		return // we have spare capacity already
+	}
+
+	if len(list.buffer) == list.maximumSize {
+		return // cannot expand any further
+	}
+
+	newSize := roundUpToPowerOfTwo(length + 1)
+	if list.maximumSize < newSize {
+		newSize = list.maximumSize
+	}
+	list.resize(newSize)
+}
+
+// return n such that v <= n and n == 2**i for some i
+func roundUpToPowerOfTwo(v int) int {
+	// http://graphics.stanford.edu/~seander/bithacks.html
+	v -= 1
+	v |= v >> 1
+	v |= v >> 2
+	v |= v >> 4
+	v |= v >> 8
+	v |= v >> 16
+	return v + 1
+}
+
+func (hist *Buffer[T]) Length() int {
+	if hist.start == -1 {
+		return 0
+	} else if hist.start < hist.end {
+		return hist.end - hist.start
+	} else {
+		return len(hist.buffer) - (hist.start - hist.end)
+	}
+}
+
+func (list *Buffer[T]) resize(size int) {
+	newbuffer := make([]T, size)
+
+	if list.start == -1 {
+		// indices are already correct and nothing needs to be copied
+	} else if size == 0 {
+		// this is now the empty list
+		list.start = -1
+		list.end = -1
+	} else {
+		currentLength := list.Length()
+		start := list.start
+		end := list.end
+		// if we're truncating, keep the latest entries, not the earliest
+		if size < currentLength {
+			start = list.end - size
+			if start < 0 {
+				start += len(list.buffer)
+			}
+		}
+		if start < end {
+			copied := copy(newbuffer, list.buffer[start:end])
+			list.start = 0
+			list.end = copied % size
+		} else {
+			lenInitial := len(list.buffer) - start
+			copied := copy(newbuffer, list.buffer[start:])
+			copied += copy(newbuffer[lenInitial:], list.buffer[:end])
+			list.start = 0
+			list.end = copied % size
+		}
+	}
+
+	list.buffer = newbuffer
+}
+
+func (hist *Buffer[T]) Clear() {
+	hist.Range(true, func(item *T) bool {
+		var zero T
+		*item = zero
+		return false
+	})
+	hist.start = -1
+	hist.end = -1
+}
diff --git a/vendor/github.com/chzyer/readline/runes.go b/vendor/github.com/ergochat/readline/internal/runes/runes.go
similarity index 50%
rename from vendor/github.com/chzyer/readline/runes.go
rename to vendor/github.com/ergochat/readline/internal/runes/runes.go
index bcf483e..52bb3fa 100644
--- a/vendor/github.com/chzyer/readline/runes.go
+++ b/vendor/github.com/ergochat/readline/internal/runes/runes.go
@@ -1,17 +1,15 @@
-package readline
+package runes
 
 import (
 	"bytes"
+	"golang.org/x/text/width"
 	"unicode"
 	"unicode/utf8"
 )
 
-var runes = Runes{}
 var TabWidth = 4
 
-type Runes struct{}
-
-func (Runes) EqualRune(a, b rune, fold bool) bool {
+func EqualRune(a, b rune, fold bool) bool {
 	if a == b {
 		return true
 	}
@@ -29,16 +27,16 @@ func (Runes) EqualRune(a, b rune, fold bool) bool {
 	return false
 }
 
-func (r Runes) EqualRuneFold(a, b rune) bool {
-	return r.EqualRune(a, b, true)
+func EqualRuneFold(a, b rune) bool {
+	return EqualRune(a, b, true)
 }
 
-func (r Runes) EqualFold(a, b []rune) bool {
+func EqualFold(a, b []rune) bool {
 	if len(a) != len(b) {
 		return false
 	}
 	for i := 0; i < len(a); i++ {
-		if r.EqualRuneFold(a[i], b[i]) {
+		if EqualRuneFold(a[i], b[i]) {
 			continue
 		}
 		return false
@@ -47,7 +45,7 @@ func (r Runes) EqualFold(a, b []rune) bool {
 	return true
 }
 
-func (Runes) Equal(a, b []rune) bool {
+func Equal(a, b []rune) bool {
 	if len(a) != len(b) {
 		return false
 	}
@@ -59,11 +57,11 @@ func (Runes) Equal(a, b []rune) bool {
 	return true
 }
 
-func (rs Runes) IndexAllBckEx(r, sub []rune, fold bool) int {
+func IndexAllBckEx(r, sub []rune, fold bool) int {
 	for i := len(r) - len(sub); i >= 0; i-- {
 		found := true
 		for j := 0; j < len(sub); j++ {
-			if !rs.EqualRune(r[i+j], sub[j], fold) {
+			if !EqualRune(r[i+j], sub[j], fold) {
 				found = false
 				break
 			}
@@ -76,23 +74,23 @@ func (rs Runes) IndexAllBckEx(r, sub []rune, fold bool) int {
 }
 
 // Search in runes from end to front
-func (rs Runes) IndexAllBck(r, sub []rune) int {
-	return rs.IndexAllBckEx(r, sub, false)
+func IndexAllBck(r, sub []rune) int {
+	return IndexAllBckEx(r, sub, false)
 }
 
 // Search in runes from front to end
-func (rs Runes) IndexAll(r, sub []rune) int {
-	return rs.IndexAllEx(r, sub, false)
+func IndexAll(r, sub []rune) int {
+	return IndexAllEx(r, sub, false)
 }
 
-func (rs Runes) IndexAllEx(r, sub []rune, fold bool) int {
+func IndexAllEx(r, sub []rune, fold bool) int {
 	for i := 0; i < len(r); i++ {
 		found := true
 		if len(r[i:]) < len(sub) {
 			return -1
 		}
 		for j := 0; j < len(sub); j++ {
-			if !rs.EqualRune(r[i+j], sub[j], fold) {
+			if !EqualRune(r[i+j], sub[j], fold) {
 				found = false
 				break
 			}
@@ -104,7 +102,7 @@ func (rs Runes) IndexAllEx(r, sub []rune, fold bool) int {
 	return -1
 }
 
-func (Runes) Index(r rune, rs []rune) int {
+func Index(r rune, rs []rune) int {
 	for i := 0; i < len(rs); i++ {
 		if rs[i] == r {
 			return i
@@ -113,11 +111,11 @@ func (Runes) Index(r rune, rs []rune) int {
 	return -1
 }
 
-func (Runes) ColorFilter(r []rune) []rune {
+func ColorFilter(r []rune) []rune {
 	newr := make([]rune, 0, len(r))
 	for pos := 0; pos < len(r); pos++ {
 		if r[pos] == '\033' && r[pos+1] == '[' {
-			idx := runes.Index('m', r[pos+2:])
+			idx := Index('m', r[pos+2:])
 			if idx == -1 {
 				continue
 			}
@@ -141,54 +139,55 @@ var doubleWidth = []*unicode.RangeTable{
 	unicode.Hangul,
 	unicode.Hiragana,
 	unicode.Katakana,
-	unicode.So,
 }
 
-func (Runes) Width(r rune) int {
+func Width(r rune) int {
 	if r == '\t' {
 		return TabWidth
 	}
 	if unicode.IsOneOf(zeroWidth, r) {
 		return 0
 	}
-	if unicode.IsOneOf(doubleWidth, r) {
+	switch width.LookupRune(r).Kind() {
+	case width.EastAsianWide, width.EastAsianFullwidth:
 		return 2
+	default:
+		return 1
 	}
-	return 1
 }
 
-func (Runes) WidthAll(r []rune) (length int) {
+func WidthAll(r []rune) (length int) {
 	for i := 0; i < len(r); i++ {
-		length += runes.Width(r[i])
+		length += Width(r[i])
 	}
 	return
 }
 
-func (Runes) Backspace(r []rune) []byte {
-	return bytes.Repeat([]byte{'\b'}, runes.WidthAll(r))
+func Backspace(r []rune) []byte {
+	return bytes.Repeat([]byte{'\b'}, WidthAll(r))
 }
 
-func (Runes) Copy(r []rune) []rune {
+func Copy(r []rune) []rune {
 	n := make([]rune, len(r))
 	copy(n, r)
 	return n
 }
 
-func (Runes) HasPrefixFold(r, prefix []rune) bool {
+func HasPrefixFold(r, prefix []rune) bool {
 	if len(r) < len(prefix) {
 		return false
 	}
-	return runes.EqualFold(r[:len(prefix)], prefix)
+	return EqualFold(r[:len(prefix)], prefix)
 }
 
-func (Runes) HasPrefix(r, prefix []rune) bool {
+func HasPrefix(r, prefix []rune) bool {
 	if len(r) < len(prefix) {
 		return false
 	}
-	return runes.Equal(r[:len(prefix)], prefix)
+	return Equal(r[:len(prefix)], prefix)
 }
 
-func (Runes) Aggregate(candicate [][]rune) (same []rune, size int) {
+func Aggregate(candicate [][]rune) (same []rune, size int) {
 	for i := 0; i < len(candicate[0]); i++ {
 		for j := 0; j < len(candicate)-1; j++ {
 			if i >= len(candicate[j]) || i >= len(candicate[j+1]) {
@@ -202,9 +201,9 @@ func (Runes) Aggregate(candicate [][]rune) (same []rune, size int) {
 	}
 aggregate:
 	if size > 0 {
-		same = runes.Copy(candicate[0][:size])
+		same = Copy(candicate[0][:size])
 		for i := 0; i < len(candicate); i++ {
-			n := runes.Copy(candicate[i])
+			n := Copy(candicate[i])
 			copy(n, n[size:])
 			candicate[i] = n[:len(n)-size]
 		}
@@ -212,7 +211,7 @@ aggregate:
 	return
 }
 
-func (Runes) TrimSpaceLeft(in []rune) []rune {
+func TrimSpaceLeft(in []rune) []rune {
 	firstIndex := len(in)
 	for i, r := range in {
 		if unicode.IsSpace(r) == false {
@@ -222,3 +221,44 @@ func (Runes) TrimSpaceLeft(in []rune) []rune {
 	}
 	return in[firstIndex:]
 }
+
+func IsWordBreak(i rune) bool {
+	switch {
+	case i >= 'a' && i <= 'z':
+	case i >= 'A' && i <= 'Z':
+	case i >= '0' && i <= '9':
+	default:
+		return true
+	}
+	return false
+}
+
+// split prompt + runes into lines by screenwidth starting from an offset.
+// the prompt should be filtered before passing to only its display runes.
+// if you know the width of the next character, pass it in as it is used
+// to decide if we generate an extra empty rune array to show next is new
+// line.
+func SplitByLine(prompt, rs []rune, offset, screenWidth, nextWidth int) [][]rune {
+	ret := make([][]rune, 0)
+	prs := append(prompt, rs...)
+	si := 0
+	currentWidth := offset
+	for i, r := range prs {
+		w := Width(r)
+		if r == '\n' {
+			ret = append(ret, prs[si:i+1])
+			si = i + 1
+			currentWidth = 0
+		} else if currentWidth+w > screenWidth {
+			ret = append(ret, prs[si:i])
+			si = i
+			currentWidth = 0
+		}
+		currentWidth += w
+	}
+	ret = append(ret, prs[si:])
+	if currentWidth+nextWidth > screenWidth {
+		ret = append(ret, []rune{})
+	}
+	return ret
+}
diff --git a/vendor/github.com/ergochat/readline/internal/term/term.go b/vendor/github.com/ergochat/readline/internal/term/term.go
new file mode 100644
index 0000000..1a40d10
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/term/term.go
@@ -0,0 +1,60 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package term provides support functions for dealing with terminals, as
+// commonly found on UNIX systems.
+//
+// Putting a terminal into raw mode is the most common requirement:
+//
+//	oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
+//	if err != nil {
+//	        panic(err)
+//	}
+//	defer term.Restore(int(os.Stdin.Fd()), oldState)
+//
+// Note that on non-Unix systems os.Stdin.Fd() may not be 0.
+package term
+
+// State contains the state of a terminal.
+type State struct {
+	state
+}
+
+// IsTerminal returns whether the given file descriptor is a terminal.
+func IsTerminal(fd int) bool {
+	return isTerminal(fd)
+}
+
+// MakeRaw puts the terminal connected to the given file descriptor into raw
+// mode and returns the previous state of the terminal so that it can be
+// restored.
+func MakeRaw(fd int) (*State, error) {
+	return makeRaw(fd)
+}
+
+// GetState returns the current state of a terminal which may be useful to
+// restore the terminal after a signal.
+func GetState(fd int) (*State, error) {
+	return getState(fd)
+}
+
+// Restore restores the terminal connected to the given file descriptor to a
+// previous state.
+func Restore(fd int, oldState *State) error {
+	return restore(fd, oldState)
+}
+
+// GetSize returns the visible dimensions of the given terminal.
+//
+// These dimensions don't include any scrollback buffer height.
+func GetSize(fd int) (width, height int, err error) {
+	return getSize(fd)
+}
+
+// ReadPassword reads a line of input from a terminal without local echo.  This
+// is commonly used for inputting passwords and other sensitive data. The slice
+// returned does not include the \n.
+func ReadPassword(fd int) ([]byte, error) {
+	return readPassword(fd)
+}
diff --git a/vendor/github.com/ergochat/readline/internal/term/term_plan9.go b/vendor/github.com/ergochat/readline/internal/term/term_plan9.go
new file mode 100644
index 0000000..21afa55
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/term/term_plan9.go
@@ -0,0 +1,42 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package term
+
+import (
+	"fmt"
+	"runtime"
+
+	"golang.org/x/sys/plan9"
+)
+
+type state struct{}
+
+func isTerminal(fd int) bool {
+	path, err := plan9.Fd2path(fd)
+	if err != nil {
+		return false
+	}
+	return path == "/dev/cons" || path == "/mnt/term/dev/cons"
+}
+
+func makeRaw(fd int) (*State, error) {
+	return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
+}
+
+func getState(fd int) (*State, error) {
+	return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
+}
+
+func restore(fd int, state *State) error {
+	return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
+}
+
+func getSize(fd int) (width, height int, err error) {
+	return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
+}
+
+func readPassword(fd int) ([]byte, error) {
+	return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
+}
diff --git a/vendor/github.com/ergochat/readline/internal/term/term_unix.go b/vendor/github.com/ergochat/readline/internal/term/term_unix.go
new file mode 100644
index 0000000..a6a6254
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/term/term_unix.go
@@ -0,0 +1,91 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
+
+package term
+
+import (
+	"golang.org/x/sys/unix"
+)
+
+type state struct {
+	termios unix.Termios
+}
+
+func isTerminal(fd int) bool {
+	_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
+	return err == nil
+}
+
+func makeRaw(fd int) (*State, error) {
+	termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
+	if err != nil {
+		return nil, err
+	}
+
+	oldState := State{state{termios: *termios}}
+
+	// This attempts to replicate the behaviour documented for cfmakeraw in
+	// the termios(3) manpage.
+	termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
+	//termios.Oflag &^= unix.OPOST
+	termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
+	termios.Cflag &^= unix.CSIZE | unix.PARENB
+	termios.Cflag |= unix.CS8
+	termios.Cc[unix.VMIN] = 1
+	termios.Cc[unix.VTIME] = 0
+	if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, termios); err != nil {
+		return nil, err
+	}
+
+	return &oldState, nil
+}
+
+func getState(fd int) (*State, error) {
+	termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
+	if err != nil {
+		return nil, err
+	}
+
+	return &State{state{termios: *termios}}, nil
+}
+
+func restore(fd int, state *State) error {
+	return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios)
+}
+
+func getSize(fd int) (width, height int, err error) {
+	ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
+	if err != nil {
+		return 0, 0, err
+	}
+	return int(ws.Col), int(ws.Row), nil
+}
+
+// passwordReader is an io.Reader that reads from a specific file descriptor.
+type passwordReader int
+
+func (r passwordReader) Read(buf []byte) (int, error) {
+	return unix.Read(int(r), buf)
+}
+
+func readPassword(fd int) ([]byte, error) {
+	termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
+	if err != nil {
+		return nil, err
+	}
+
+	newState := *termios
+	newState.Lflag &^= unix.ECHO
+	newState.Lflag |= unix.ICANON | unix.ISIG
+	newState.Iflag |= unix.ICRNL
+	if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, &newState); err != nil {
+		return nil, err
+	}
+
+	defer unix.IoctlSetTermios(fd, ioctlWriteTermios, termios)
+
+	return readPasswordLine(passwordReader(fd))
+}
diff --git a/vendor/github.com/ergochat/readline/internal/term/term_unix_bsd.go b/vendor/github.com/ergochat/readline/internal/term/term_unix_bsd.go
new file mode 100644
index 0000000..9dbf546
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/term/term_unix_bsd.go
@@ -0,0 +1,12 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build darwin || dragonfly || freebsd || netbsd || openbsd
+
+package term
+
+import "golang.org/x/sys/unix"
+
+const ioctlReadTermios = unix.TIOCGETA
+const ioctlWriteTermios = unix.TIOCSETA
diff --git a/vendor/github.com/ergochat/readline/internal/term/term_unix_other.go b/vendor/github.com/ergochat/readline/internal/term/term_unix_other.go
new file mode 100644
index 0000000..1b36de7
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/term/term_unix_other.go
@@ -0,0 +1,12 @@
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build aix || linux || solaris || zos
+
+package term
+
+import "golang.org/x/sys/unix"
+
+const ioctlReadTermios = unix.TCGETS
+const ioctlWriteTermios = unix.TCSETS
diff --git a/vendor/github.com/ergochat/readline/internal/term/term_unsupported.go b/vendor/github.com/ergochat/readline/internal/term/term_unsupported.go
new file mode 100644
index 0000000..3c409e5
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/term/term_unsupported.go
@@ -0,0 +1,38 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !zos && !windows && !solaris && !plan9
+
+package term
+
+import (
+	"fmt"
+	"runtime"
+)
+
+type state struct{}
+
+func isTerminal(fd int) bool {
+	return false
+}
+
+func makeRaw(fd int) (*State, error) {
+	return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
+}
+
+func getState(fd int) (*State, error) {
+	return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
+}
+
+func restore(fd int, state *State) error {
+	return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
+}
+
+func getSize(fd int) (width, height int, err error) {
+	return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
+}
+
+func readPassword(fd int) ([]byte, error) {
+	return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
+}
diff --git a/vendor/github.com/ergochat/readline/internal/term/term_windows.go b/vendor/github.com/ergochat/readline/internal/term/term_windows.go
new file mode 100644
index 0000000..465f560
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/term/term_windows.go
@@ -0,0 +1,79 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package term
+
+import (
+	"os"
+
+	"golang.org/x/sys/windows"
+)
+
+type state struct {
+	mode uint32
+}
+
+func isTerminal(fd int) bool {
+	var st uint32
+	err := windows.GetConsoleMode(windows.Handle(fd), &st)
+	return err == nil
+}
+
+func makeRaw(fd int) (*State, error) {
+	var st uint32
+	if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
+		return nil, err
+	}
+	raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
+	if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
+		return nil, err
+	}
+	return &State{state{st}}, nil
+}
+
+func getState(fd int) (*State, error) {
+	var st uint32
+	if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
+		return nil, err
+	}
+	return &State{state{st}}, nil
+}
+
+func restore(fd int, state *State) error {
+	return windows.SetConsoleMode(windows.Handle(fd), state.mode)
+}
+
+func getSize(fd int) (width, height int, err error) {
+	var info windows.ConsoleScreenBufferInfo
+	if err := windows.GetConsoleScreenBufferInfo(windows.Handle(fd), &info); err != nil {
+		return 0, 0, err
+	}
+	return int(info.Window.Right - info.Window.Left + 1), int(info.Window.Bottom - info.Window.Top + 1), nil
+}
+
+func readPassword(fd int) ([]byte, error) {
+	var st uint32
+	if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
+		return nil, err
+	}
+	old := st
+
+	st &^= (windows.ENABLE_ECHO_INPUT | windows.ENABLE_LINE_INPUT)
+	st |= (windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_PROCESSED_INPUT)
+	if err := windows.SetConsoleMode(windows.Handle(fd), st); err != nil {
+		return nil, err
+	}
+
+	defer windows.SetConsoleMode(windows.Handle(fd), old)
+
+	var h windows.Handle
+	p, _ := windows.GetCurrentProcess()
+	if err := windows.DuplicateHandle(p, windows.Handle(fd), p, &h, 0, false, windows.DUPLICATE_SAME_ACCESS); err != nil {
+		return nil, err
+	}
+
+	f := os.NewFile(uintptr(h), "stdin")
+	defer f.Close()
+	return readPasswordLine(f)
+}
diff --git a/vendor/github.com/ergochat/readline/internal/term/terminal.go b/vendor/github.com/ergochat/readline/internal/term/terminal.go
new file mode 100644
index 0000000..f636667
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/internal/term/terminal.go
@@ -0,0 +1,986 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package term
+
+import (
+	"bytes"
+	"io"
+	"runtime"
+	"strconv"
+	"sync"
+	"unicode/utf8"
+)
+
+// EscapeCodes contains escape sequences that can be written to the terminal in
+// order to achieve different styles of text.
+type EscapeCodes struct {
+	// Foreground colors
+	Black, Red, Green, Yellow, Blue, Magenta, Cyan, White []byte
+
+	// Reset all attributes
+	Reset []byte
+}
+
+var vt100EscapeCodes = EscapeCodes{
+	Black:   []byte{keyEscape, '[', '3', '0', 'm'},
+	Red:     []byte{keyEscape, '[', '3', '1', 'm'},
+	Green:   []byte{keyEscape, '[', '3', '2', 'm'},
+	Yellow:  []byte{keyEscape, '[', '3', '3', 'm'},
+	Blue:    []byte{keyEscape, '[', '3', '4', 'm'},
+	Magenta: []byte{keyEscape, '[', '3', '5', 'm'},
+	Cyan:    []byte{keyEscape, '[', '3', '6', 'm'},
+	White:   []byte{keyEscape, '[', '3', '7', 'm'},
+
+	Reset: []byte{keyEscape, '[', '0', 'm'},
+}
+
+// Terminal contains the state for running a VT100 terminal that is capable of
+// reading lines of input.
+type Terminal struct {
+	// AutoCompleteCallback, if non-null, is called for each keypress with
+	// the full input line and the current position of the cursor (in
+	// bytes, as an index into |line|). If it returns ok=false, the key
+	// press is processed normally. Otherwise it returns a replacement line
+	// and the new cursor position.
+	AutoCompleteCallback func(line string, pos int, key rune) (newLine string, newPos int, ok bool)
+
+	// Escape contains a pointer to the escape codes for this terminal.
+	// It's always a valid pointer, although the escape codes themselves
+	// may be empty if the terminal doesn't support them.
+	Escape *EscapeCodes
+
+	// lock protects the terminal and the state in this object from
+	// concurrent processing of a key press and a Write() call.
+	lock sync.Mutex
+
+	c      io.ReadWriter
+	prompt []rune
+
+	// line is the current line being entered.
+	line []rune
+	// pos is the logical position of the cursor in line
+	pos int
+	// echo is true if local echo is enabled
+	echo bool
+	// pasteActive is true iff there is a bracketed paste operation in
+	// progress.
+	pasteActive bool
+
+	// cursorX contains the current X value of the cursor where the left
+	// edge is 0. cursorY contains the row number where the first row of
+	// the current line is 0.
+	cursorX, cursorY int
+	// maxLine is the greatest value of cursorY so far.
+	maxLine int
+
+	termWidth, termHeight int
+
+	// outBuf contains the terminal data to be sent.
+	outBuf []byte
+	// remainder contains the remainder of any partial key sequences after
+	// a read. It aliases into inBuf.
+	remainder []byte
+	inBuf     [256]byte
+
+	// history contains previously entered commands so that they can be
+	// accessed with the up and down keys.
+	history stRingBuffer
+	// historyIndex stores the currently accessed history entry, where zero
+	// means the immediately previous entry.
+	historyIndex int
+	// When navigating up and down the history it's possible to return to
+	// the incomplete, initial line. That value is stored in
+	// historyPending.
+	historyPending string
+}
+
+// NewTerminal runs a VT100 terminal on the given ReadWriter. If the ReadWriter is
+// a local terminal, that terminal must first have been put into raw mode.
+// prompt is a string that is written at the start of each input line (i.e.
+// "> ").
+func NewTerminal(c io.ReadWriter, prompt string) *Terminal {
+	return &Terminal{
+		Escape:       &vt100EscapeCodes,
+		c:            c,
+		prompt:       []rune(prompt),
+		termWidth:    80,
+		termHeight:   24,
+		echo:         true,
+		historyIndex: -1,
+	}
+}
+
+const (
+	keyCtrlC     = 3
+	keyCtrlD     = 4
+	keyCtrlU     = 21
+	keyEnter     = '\r'
+	keyEscape    = 27
+	keyBackspace = 127
+	keyUnknown   = 0xd800 /* UTF-16 surrogate area */ + iota
+	keyUp
+	keyDown
+	keyLeft
+	keyRight
+	keyAltLeft
+	keyAltRight
+	keyHome
+	keyEnd
+	keyDeleteWord
+	keyDeleteLine
+	keyClearScreen
+	keyPasteStart
+	keyPasteEnd
+)
+
+var (
+	crlf       = []byte{'\r', '\n'}
+	pasteStart = []byte{keyEscape, '[', '2', '0', '0', '~'}
+	pasteEnd   = []byte{keyEscape, '[', '2', '0', '1', '~'}
+)
+
+// bytesToKey tries to parse a key sequence from b. If successful, it returns
+// the key and the remainder of the input. Otherwise it returns utf8.RuneError.
+func bytesToKey(b []byte, pasteActive bool) (rune, []byte) {
+	if len(b) == 0 {
+		return utf8.RuneError, nil
+	}
+
+	if !pasteActive {
+		switch b[0] {
+		case 1: // ^A
+			return keyHome, b[1:]
+		case 2: // ^B
+			return keyLeft, b[1:]
+		case 5: // ^E
+			return keyEnd, b[1:]
+		case 6: // ^F
+			return keyRight, b[1:]
+		case 8: // ^H
+			return keyBackspace, b[1:]
+		case 11: // ^K
+			return keyDeleteLine, b[1:]
+		case 12: // ^L
+			return keyClearScreen, b[1:]
+		case 23: // ^W
+			return keyDeleteWord, b[1:]
+		case 14: // ^N
+			return keyDown, b[1:]
+		case 16: // ^P
+			return keyUp, b[1:]
+		}
+	}
+
+	if b[0] != keyEscape {
+		if !utf8.FullRune(b) {
+			return utf8.RuneError, b
+		}
+		r, l := utf8.DecodeRune(b)
+		return r, b[l:]
+	}
+
+	if !pasteActive && len(b) >= 3 && b[0] == keyEscape && b[1] == '[' {
+		switch b[2] {
+		case 'A':
+			return keyUp, b[3:]
+		case 'B':
+			return keyDown, b[3:]
+		case 'C':
+			return keyRight, b[3:]
+		case 'D':
+			return keyLeft, b[3:]
+		case 'H':
+			return keyHome, b[3:]
+		case 'F':
+			return keyEnd, b[3:]
+		}
+	}
+
+	if !pasteActive && len(b) >= 6 && b[0] == keyEscape && b[1] == '[' && b[2] == '1' && b[3] == ';' && b[4] == '3' {
+		switch b[5] {
+		case 'C':
+			return keyAltRight, b[6:]
+		case 'D':
+			return keyAltLeft, b[6:]
+		}
+	}
+
+	if !pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteStart) {
+		return keyPasteStart, b[6:]
+	}
+
+	if pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteEnd) {
+		return keyPasteEnd, b[6:]
+	}
+
+	// If we get here then we have a key that we don't recognise, or a
+	// partial sequence. It's not clear how one should find the end of a
+	// sequence without knowing them all, but it seems that [a-zA-Z~] only
+	// appears at the end of a sequence.
+	for i, c := range b[0:] {
+		if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '~' {
+			return keyUnknown, b[i+1:]
+		}
+	}
+
+	return utf8.RuneError, b
+}
+
+// queue appends data to the end of t.outBuf
+func (t *Terminal) queue(data []rune) {
+	t.outBuf = append(t.outBuf, []byte(string(data))...)
+}
+
+var space = []rune{' '}
+
+func isPrintable(key rune) bool {
+	isInSurrogateArea := key >= 0xd800 && key <= 0xdbff
+	return key >= 32 && !isInSurrogateArea
+}
+
+// moveCursorToPos appends data to t.outBuf which will move the cursor to the
+// given, logical position in the text.
+func (t *Terminal) moveCursorToPos(pos int) {
+	if !t.echo {
+		return
+	}
+
+	x := visualLength(t.prompt) + pos
+	y := x / t.termWidth
+	x = x % t.termWidth
+
+	up := 0
+	if y < t.cursorY {
+		up = t.cursorY - y
+	}
+
+	down := 0
+	if y > t.cursorY {
+		down = y - t.cursorY
+	}
+
+	left := 0
+	if x < t.cursorX {
+		left = t.cursorX - x
+	}
+
+	right := 0
+	if x > t.cursorX {
+		right = x - t.cursorX
+	}
+
+	t.cursorX = x
+	t.cursorY = y
+	t.move(up, down, left, right)
+}
+
+func (t *Terminal) move(up, down, left, right int) {
+	m := []rune{}
+
+	// 1 unit up can be expressed as ^[[A or ^[A
+	// 5 units up can be expressed as ^[[5A
+
+	if up == 1 {
+		m = append(m, keyEscape, '[', 'A')
+	} else if up > 1 {
+		m = append(m, keyEscape, '[')
+		m = append(m, []rune(strconv.Itoa(up))...)
+		m = append(m, 'A')
+	}
+
+	if down == 1 {
+		m = append(m, keyEscape, '[', 'B')
+	} else if down > 1 {
+		m = append(m, keyEscape, '[')
+		m = append(m, []rune(strconv.Itoa(down))...)
+		m = append(m, 'B')
+	}
+
+	if right == 1 {
+		m = append(m, keyEscape, '[', 'C')
+	} else if right > 1 {
+		m = append(m, keyEscape, '[')
+		m = append(m, []rune(strconv.Itoa(right))...)
+		m = append(m, 'C')
+	}
+
+	if left == 1 {
+		m = append(m, keyEscape, '[', 'D')
+	} else if left > 1 {
+		m = append(m, keyEscape, '[')
+		m = append(m, []rune(strconv.Itoa(left))...)
+		m = append(m, 'D')
+	}
+
+	t.queue(m)
+}
+
+func (t *Terminal) clearLineToRight() {
+	op := []rune{keyEscape, '[', 'K'}
+	t.queue(op)
+}
+
+const maxLineLength = 4096
+
+func (t *Terminal) setLine(newLine []rune, newPos int) {
+	if t.echo {
+		t.moveCursorToPos(0)
+		t.writeLine(newLine)
+		for i := len(newLine); i < len(t.line); i++ {
+			t.writeLine(space)
+		}
+		t.moveCursorToPos(newPos)
+	}
+	t.line = newLine
+	t.pos = newPos
+}
+
+func (t *Terminal) advanceCursor(places int) {
+	t.cursorX += places
+	t.cursorY += t.cursorX / t.termWidth
+	if t.cursorY > t.maxLine {
+		t.maxLine = t.cursorY
+	}
+	t.cursorX = t.cursorX % t.termWidth
+
+	if places > 0 && t.cursorX == 0 {
+		// Normally terminals will advance the current position
+		// when writing a character. But that doesn't happen
+		// for the last character in a line. However, when
+		// writing a character (except a new line) that causes
+		// a line wrap, the position will be advanced two
+		// places.
+		//
+		// So, if we are stopping at the end of a line, we
+		// need to write a newline so that our cursor can be
+		// advanced to the next line.
+		t.outBuf = append(t.outBuf, '\r', '\n')
+	}
+}
+
+func (t *Terminal) eraseNPreviousChars(n int) {
+	if n == 0 {
+		return
+	}
+
+	if t.pos < n {
+		n = t.pos
+	}
+	t.pos -= n
+	t.moveCursorToPos(t.pos)
+
+	copy(t.line[t.pos:], t.line[n+t.pos:])
+	t.line = t.line[:len(t.line)-n]
+	if t.echo {
+		t.writeLine(t.line[t.pos:])
+		for i := 0; i < n; i++ {
+			t.queue(space)
+		}
+		t.advanceCursor(n)
+		t.moveCursorToPos(t.pos)
+	}
+}
+
+// countToLeftWord returns then number of characters from the cursor to the
+// start of the previous word.
+func (t *Terminal) countToLeftWord() int {
+	if t.pos == 0 {
+		return 0
+	}
+
+	pos := t.pos - 1
+	for pos > 0 {
+		if t.line[pos] != ' ' {
+			break
+		}
+		pos--
+	}
+	for pos > 0 {
+		if t.line[pos] == ' ' {
+			pos++
+			break
+		}
+		pos--
+	}
+
+	return t.pos - pos
+}
+
+// countToRightWord returns then number of characters from the cursor to the
+// start of the next word.
+func (t *Terminal) countToRightWord() int {
+	pos := t.pos
+	for pos < len(t.line) {
+		if t.line[pos] == ' ' {
+			break
+		}
+		pos++
+	}
+	for pos < len(t.line) {
+		if t.line[pos] != ' ' {
+			break
+		}
+		pos++
+	}
+	return pos - t.pos
+}
+
+// visualLength returns the number of visible glyphs in s.
+func visualLength(runes []rune) int {
+	inEscapeSeq := false
+	length := 0
+
+	for _, r := range runes {
+		switch {
+		case inEscapeSeq:
+			if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') {
+				inEscapeSeq = false
+			}
+		case r == '\x1b':
+			inEscapeSeq = true
+		default:
+			length++
+		}
+	}
+
+	return length
+}
+
+// handleKey processes the given key and, optionally, returns a line of text
+// that the user has entered.
+func (t *Terminal) handleKey(key rune) (line string, ok bool) {
+	if t.pasteActive && key != keyEnter {
+		t.addKeyToLine(key)
+		return
+	}
+
+	switch key {
+	case keyBackspace:
+		if t.pos == 0 {
+			return
+		}
+		t.eraseNPreviousChars(1)
+	case keyAltLeft:
+		// move left by a word.
+		t.pos -= t.countToLeftWord()
+		t.moveCursorToPos(t.pos)
+	case keyAltRight:
+		// move right by a word.
+		t.pos += t.countToRightWord()
+		t.moveCursorToPos(t.pos)
+	case keyLeft:
+		if t.pos == 0 {
+			return
+		}
+		t.pos--
+		t.moveCursorToPos(t.pos)
+	case keyRight:
+		if t.pos == len(t.line) {
+			return
+		}
+		t.pos++
+		t.moveCursorToPos(t.pos)
+	case keyHome:
+		if t.pos == 0 {
+			return
+		}
+		t.pos = 0
+		t.moveCursorToPos(t.pos)
+	case keyEnd:
+		if t.pos == len(t.line) {
+			return
+		}
+		t.pos = len(t.line)
+		t.moveCursorToPos(t.pos)
+	case keyUp:
+		entry, ok := t.history.NthPreviousEntry(t.historyIndex + 1)
+		if !ok {
+			return "", false
+		}
+		if t.historyIndex == -1 {
+			t.historyPending = string(t.line)
+		}
+		t.historyIndex++
+		runes := []rune(entry)
+		t.setLine(runes, len(runes))
+	case keyDown:
+		switch t.historyIndex {
+		case -1:
+			return
+		case 0:
+			runes := []rune(t.historyPending)
+			t.setLine(runes, len(runes))
+			t.historyIndex--
+		default:
+			entry, ok := t.history.NthPreviousEntry(t.historyIndex - 1)
+			if ok {
+				t.historyIndex--
+				runes := []rune(entry)
+				t.setLine(runes, len(runes))
+			}
+		}
+	case keyEnter:
+		t.moveCursorToPos(len(t.line))
+		t.queue([]rune("\r\n"))
+		line = string(t.line)
+		ok = true
+		t.line = t.line[:0]
+		t.pos = 0
+		t.cursorX = 0
+		t.cursorY = 0
+		t.maxLine = 0
+	case keyDeleteWord:
+		// Delete zero or more spaces and then one or more characters.
+		t.eraseNPreviousChars(t.countToLeftWord())
+	case keyDeleteLine:
+		// Delete everything from the current cursor position to the
+		// end of line.
+		for i := t.pos; i < len(t.line); i++ {
+			t.queue(space)
+			t.advanceCursor(1)
+		}
+		t.line = t.line[:t.pos]
+		t.moveCursorToPos(t.pos)
+	case keyCtrlD:
+		// Erase the character under the current position.
+		// The EOF case when the line is empty is handled in
+		// readLine().
+		if t.pos < len(t.line) {
+			t.pos++
+			t.eraseNPreviousChars(1)
+		}
+	case keyCtrlU:
+		t.eraseNPreviousChars(t.pos)
+	case keyClearScreen:
+		// Erases the screen and moves the cursor to the home position.
+		t.queue([]rune("\x1b[2J\x1b[H"))
+		t.queue(t.prompt)
+		t.cursorX, t.cursorY = 0, 0
+		t.advanceCursor(visualLength(t.prompt))
+		t.setLine(t.line, t.pos)
+	default:
+		if t.AutoCompleteCallback != nil {
+			prefix := string(t.line[:t.pos])
+			suffix := string(t.line[t.pos:])
+
+			t.lock.Unlock()
+			newLine, newPos, completeOk := t.AutoCompleteCallback(prefix+suffix, len(prefix), key)
+			t.lock.Lock()
+
+			if completeOk {
+				t.setLine([]rune(newLine), utf8.RuneCount([]byte(newLine)[:newPos]))
+				return
+			}
+		}
+		if !isPrintable(key) {
+			return
+		}
+		if len(t.line) == maxLineLength {
+			return
+		}
+		t.addKeyToLine(key)
+	}
+	return
+}
+
+// addKeyToLine inserts the given key at the current position in the current
+// line.
+func (t *Terminal) addKeyToLine(key rune) {
+	if len(t.line) == cap(t.line) {
+		newLine := make([]rune, len(t.line), 2*(1+len(t.line)))
+		copy(newLine, t.line)
+		t.line = newLine
+	}
+	t.line = t.line[:len(t.line)+1]
+	copy(t.line[t.pos+1:], t.line[t.pos:])
+	t.line[t.pos] = key
+	if t.echo {
+		t.writeLine(t.line[t.pos:])
+	}
+	t.pos++
+	t.moveCursorToPos(t.pos)
+}
+
+func (t *Terminal) writeLine(line []rune) {
+	for len(line) != 0 {
+		remainingOnLine := t.termWidth - t.cursorX
+		todo := len(line)
+		if todo > remainingOnLine {
+			todo = remainingOnLine
+		}
+		t.queue(line[:todo])
+		t.advanceCursor(visualLength(line[:todo]))
+		line = line[todo:]
+	}
+}
+
+// writeWithCRLF writes buf to w but replaces all occurrences of \n with \r\n.
+func writeWithCRLF(w io.Writer, buf []byte) (n int, err error) {
+	for len(buf) > 0 {
+		i := bytes.IndexByte(buf, '\n')
+		todo := len(buf)
+		if i >= 0 {
+			todo = i
+		}
+
+		var nn int
+		nn, err = w.Write(buf[:todo])
+		n += nn
+		if err != nil {
+			return n, err
+		}
+		buf = buf[todo:]
+
+		if i >= 0 {
+			if _, err = w.Write(crlf); err != nil {
+				return n, err
+			}
+			n++
+			buf = buf[1:]
+		}
+	}
+
+	return n, nil
+}
+
+func (t *Terminal) Write(buf []byte) (n int, err error) {
+	t.lock.Lock()
+	defer t.lock.Unlock()
+
+	if t.cursorX == 0 && t.cursorY == 0 {
+		// This is the easy case: there's nothing on the screen that we
+		// have to move out of the way.
+		return writeWithCRLF(t.c, buf)
+	}
+
+	// We have a prompt and possibly user input on the screen. We
+	// have to clear it first.
+	t.move(0 /* up */, 0 /* down */, t.cursorX /* left */, 0 /* right */)
+	t.cursorX = 0
+	t.clearLineToRight()
+
+	for t.cursorY > 0 {
+		t.move(1 /* up */, 0, 0, 0)
+		t.cursorY--
+		t.clearLineToRight()
+	}
+
+	if _, err = t.c.Write(t.outBuf); err != nil {
+		return
+	}
+	t.outBuf = t.outBuf[:0]
+
+	if n, err = writeWithCRLF(t.c, buf); err != nil {
+		return
+	}
+
+	t.writeLine(t.prompt)
+	if t.echo {
+		t.writeLine(t.line)
+	}
+
+	t.moveCursorToPos(t.pos)
+
+	if _, err = t.c.Write(t.outBuf); err != nil {
+		return
+	}
+	t.outBuf = t.outBuf[:0]
+	return
+}
+
+// ReadPassword temporarily changes the prompt and reads a password, without
+// echo, from the terminal.
+func (t *Terminal) ReadPassword(prompt string) (line string, err error) {
+	t.lock.Lock()
+	defer t.lock.Unlock()
+
+	oldPrompt := t.prompt
+	t.prompt = []rune(prompt)
+	t.echo = false
+
+	line, err = t.readLine()
+
+	t.prompt = oldPrompt
+	t.echo = true
+
+	return
+}
+
+// ReadLine returns a line of input from the terminal.
+func (t *Terminal) ReadLine() (line string, err error) {
+	t.lock.Lock()
+	defer t.lock.Unlock()
+
+	return t.readLine()
+}
+
+func (t *Terminal) readLine() (line string, err error) {
+	// t.lock must be held at this point
+
+	if t.cursorX == 0 && t.cursorY == 0 {
+		t.writeLine(t.prompt)
+		t.c.Write(t.outBuf)
+		t.outBuf = t.outBuf[:0]
+	}
+
+	lineIsPasted := t.pasteActive
+
+	for {
+		rest := t.remainder
+		lineOk := false
+		for !lineOk {
+			var key rune
+			key, rest = bytesToKey(rest, t.pasteActive)
+			if key == utf8.RuneError {
+				break
+			}
+			if !t.pasteActive {
+				if key == keyCtrlD {
+					if len(t.line) == 0 {
+						return "", io.EOF
+					}
+				}
+				if key == keyCtrlC {
+					return "", io.EOF
+				}
+				if key == keyPasteStart {
+					t.pasteActive = true
+					if len(t.line) == 0 {
+						lineIsPasted = true
+					}
+					continue
+				}
+			} else if key == keyPasteEnd {
+				t.pasteActive = false
+				continue
+			}
+			if !t.pasteActive {
+				lineIsPasted = false
+			}
+			line, lineOk = t.handleKey(key)
+		}
+		if len(rest) > 0 {
+			n := copy(t.inBuf[:], rest)
+			t.remainder = t.inBuf[:n]
+		} else {
+			t.remainder = nil
+		}
+		t.c.Write(t.outBuf)
+		t.outBuf = t.outBuf[:0]
+		if lineOk {
+			if t.echo {
+				t.historyIndex = -1
+				t.history.Add(line)
+			}
+			if lineIsPasted {
+				err = ErrPasteIndicator
+			}
+			return
+		}
+
+		// t.remainder is a slice at the beginning of t.inBuf
+		// containing a partial key sequence
+		readBuf := t.inBuf[len(t.remainder):]
+		var n int
+
+		t.lock.Unlock()
+		n, err = t.c.Read(readBuf)
+		t.lock.Lock()
+
+		if err != nil {
+			return
+		}
+
+		t.remainder = t.inBuf[:n+len(t.remainder)]
+	}
+}
+
+// SetPrompt sets the prompt to be used when reading subsequent lines.
+func (t *Terminal) SetPrompt(prompt string) {
+	t.lock.Lock()
+	defer t.lock.Unlock()
+
+	t.prompt = []rune(prompt)
+}
+
+func (t *Terminal) clearAndRepaintLinePlusNPrevious(numPrevLines int) {
+	// Move cursor to column zero at the start of the line.
+	t.move(t.cursorY, 0, t.cursorX, 0)
+	t.cursorX, t.cursorY = 0, 0
+	t.clearLineToRight()
+	for t.cursorY < numPrevLines {
+		// Move down a line
+		t.move(0, 1, 0, 0)
+		t.cursorY++
+		t.clearLineToRight()
+	}
+	// Move back to beginning.
+	t.move(t.cursorY, 0, 0, 0)
+	t.cursorX, t.cursorY = 0, 0
+
+	t.queue(t.prompt)
+	t.advanceCursor(visualLength(t.prompt))
+	t.writeLine(t.line)
+	t.moveCursorToPos(t.pos)
+}
+
+func (t *Terminal) SetSize(width, height int) error {
+	t.lock.Lock()
+	defer t.lock.Unlock()
+
+	if width == 0 {
+		width = 1
+	}
+
+	oldWidth := t.termWidth
+	t.termWidth, t.termHeight = width, height
+
+	switch {
+	case width == oldWidth:
+		// If the width didn't change then nothing else needs to be
+		// done.
+		return nil
+	case len(t.line) == 0 && t.cursorX == 0 && t.cursorY == 0:
+		// If there is nothing on current line and no prompt printed,
+		// just do nothing
+		return nil
+	case width < oldWidth:
+		// Some terminals (e.g. xterm) will truncate lines that were
+		// too long when shinking. Others, (e.g. gnome-terminal) will
+		// attempt to wrap them. For the former, repainting t.maxLine
+		// works great, but that behaviour goes badly wrong in the case
+		// of the latter because they have doubled every full line.
+
+		// We assume that we are working on a terminal that wraps lines
+		// and adjust the cursor position based on every previous line
+		// wrapping and turning into two. This causes the prompt on
+		// xterms to move upwards, which isn't great, but it avoids a
+		// huge mess with gnome-terminal.
+		if t.cursorX >= t.termWidth {
+			t.cursorX = t.termWidth - 1
+		}
+		t.cursorY *= 2
+		t.clearAndRepaintLinePlusNPrevious(t.maxLine * 2)
+	case width > oldWidth:
+		// If the terminal expands then our position calculations will
+		// be wrong in the future because we think the cursor is
+		// |t.pos| chars into the string, but there will be a gap at
+		// the end of any wrapped line.
+		//
+		// But the position will actually be correct until we move, so
+		// we can move back to the beginning and repaint everything.
+		t.clearAndRepaintLinePlusNPrevious(t.maxLine)
+	}
+
+	_, err := t.c.Write(t.outBuf)
+	t.outBuf = t.outBuf[:0]
+	return err
+}
+
+type pasteIndicatorError struct{}
+
+func (pasteIndicatorError) Error() string {
+	return "terminal: ErrPasteIndicator not correctly handled"
+}
+
+// ErrPasteIndicator may be returned from ReadLine as the error, in addition
+// to valid line data. It indicates that bracketed paste mode is enabled and
+// that the returned line consists only of pasted data. Programs may wish to
+// interpret pasted data more literally than typed data.
+var ErrPasteIndicator = pasteIndicatorError{}
+
+// SetBracketedPasteMode requests that the terminal bracket paste operations
+// with markers. Not all terminals support this but, if it is supported, then
+// enabling this mode will stop any autocomplete callback from running due to
+// pastes. Additionally, any lines that are completely pasted will be returned
+// from ReadLine with the error set to ErrPasteIndicator.
+func (t *Terminal) SetBracketedPasteMode(on bool) {
+	if on {
+		io.WriteString(t.c, "\x1b[?2004h")
+	} else {
+		io.WriteString(t.c, "\x1b[?2004l")
+	}
+}
+
+// stRingBuffer is a ring buffer of strings.
+type stRingBuffer struct {
+	// entries contains max elements.
+	entries []string
+	max     int
+	// head contains the index of the element most recently added to the ring.
+	head int
+	// size contains the number of elements in the ring.
+	size int
+}
+
+func (s *stRingBuffer) Add(a string) {
+	if s.entries == nil {
+		const defaultNumEntries = 100
+		s.entries = make([]string, defaultNumEntries)
+		s.max = defaultNumEntries
+	}
+
+	s.head = (s.head + 1) % s.max
+	s.entries[s.head] = a
+	if s.size < s.max {
+		s.size++
+	}
+}
+
+// NthPreviousEntry returns the value passed to the nth previous call to Add.
+// If n is zero then the immediately prior value is returned, if one, then the
+// next most recent, and so on. If such an element doesn't exist then ok is
+// false.
+func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) {
+	if n < 0 || n >= s.size {
+		return "", false
+	}
+	index := s.head - n
+	if index < 0 {
+		index += s.max
+	}
+	return s.entries[index], true
+}
+
+// readPasswordLine reads from reader until it finds \n or io.EOF.
+// The slice returned does not include the \n.
+// readPasswordLine also ignores any \r it finds.
+// Windows uses \r as end of line. So, on Windows, readPasswordLine
+// reads until it finds \r and ignores any \n it finds during processing.
+func readPasswordLine(reader io.Reader) ([]byte, error) {
+	var buf [1]byte
+	var ret []byte
+
+	for {
+		n, err := reader.Read(buf[:])
+		if n > 0 {
+			switch buf[0] {
+			case '\b':
+				if len(ret) > 0 {
+					ret = ret[:len(ret)-1]
+				}
+			case '\n':
+				if runtime.GOOS != "windows" {
+					return ret, nil
+				}
+				// otherwise ignore \n
+			case '\r':
+				if runtime.GOOS == "windows" {
+					return ret, nil
+				}
+				// otherwise ignore \r
+			default:
+				ret = append(ret, buf[0])
+			}
+			continue
+		}
+		if err != nil {
+			if err == io.EOF && len(ret) > 0 {
+				return ret, nil
+			}
+			return ret, err
+		}
+	}
+}
diff --git a/vendor/github.com/ergochat/readline/operation.go b/vendor/github.com/ergochat/readline/operation.go
new file mode 100644
index 0000000..1cce348
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/operation.go
@@ -0,0 +1,581 @@
+package readline
+
+import (
+	"errors"
+	"io"
+	"sync"
+	"sync/atomic"
+	"time"
+
+	"github.com/ergochat/readline/internal/platform"
+	"github.com/ergochat/readline/internal/runes"
+)
+
+var (
+	ErrInterrupt = errors.New("Interrupt")
+)
+
+type operation struct {
+	m       sync.Mutex
+	t       *terminal
+	buf     *runeBuffer
+	wrapOut atomic.Pointer[wrapWriter]
+	wrapErr atomic.Pointer[wrapWriter]
+
+	isPrompting bool // true when prompt written and waiting for input
+
+	// dsrUnsupported is set once a cursor position query has timed out. The
+	// terminal is then assumed not to implement DSR and no further queries
+	// are made, so the timeout is paid at most once per session rather than
+	// before every prompt. Read and written under m, via getAndSetOffset.
+	dsrUnsupported bool
+
+	history   *opHistory
+	search    *opSearch
+	completer *opCompleter
+	vim       *opVim
+	undo      *opUndo
+}
+
+func (o *operation) SetBuffer(what string) {
+	o.buf.SetNoRefresh([]rune(what))
+}
+
+type wrapWriter struct {
+	o      *operation
+	target io.Writer
+}
+
+func (w *wrapWriter) Write(b []byte) (int, error) {
+	return w.o.write(w.target, b)
+}
+
+func (o *operation) write(target io.Writer, b []byte) (int, error) {
+	o.m.Lock()
+	defer o.m.Unlock()
+
+	if !o.isPrompting {
+		return target.Write(b)
+	}
+
+	var (
+		n   int
+		err error
+	)
+	o.buf.Refresh(func() {
+		n, err = target.Write(b)
+		// Adjust the prompt start position by b
+		rout := runes.ColorFilter([]rune(string(b[:])))
+		tWidth, _ := o.t.GetWidthHeight()
+		sp := runes.SplitByLine(rout, []rune{}, o.buf.ppos, tWidth, 1)
+		if len(sp) > 1 {
+			o.buf.ppos = len(sp[len(sp)-1])
+		} else {
+			o.buf.ppos += len(rout)
+		}
+	})
+
+	o.search.RefreshIfNeeded()
+	if o.completer.IsInCompleteMode() {
+		o.completer.CompleteRefresh()
+	}
+	return n, err
+}
+
+func newOperation(t *terminal) *operation {
+	cfg := t.GetConfig()
+	op := &operation{
+		t:   t,
+		buf: newRuneBuffer(t),
+	}
+	op.SetConfig(cfg)
+	op.vim = newVimMode(op)
+	op.completer = newOpCompleter(op.buf.w, op)
+	cfg.FuncOnWidthChanged(t.OnSizeChange)
+	return op
+}
+
+func (o *operation) GetConfig() *Config {
+	return o.t.GetConfig()
+}
+
+func (o *operation) readline(deadline chan struct{}) ([]rune, error) {
+	isTyping := false // don't add new undo entries during normal typing
+
+	for {
+		keepInSearchMode := false
+		keepInCompleteMode := false
+		r, err := o.t.GetRune(deadline)
+
+		if cfg := o.GetConfig(); cfg.FuncFilterInputRune != nil && err == nil {
+			var process bool
+			r, process = cfg.FuncFilterInputRune(r)
+			if !process {
+				o.buf.Refresh(nil) // to refresh the line
+				continue           // ignore this rune
+			}
+		}
+
+		if err == io.EOF {
+			if o.buf.Len() == 0 {
+				o.buf.Clean()
+				return nil, io.EOF
+			} else {
+				// if stdin got io.EOF and there is something left in buffer,
+				// let's flush them by sending CharEnter.
+				// And we will got io.EOF int next loop.
+				r = CharEnter
+			}
+		} else if err != nil {
+			return nil, err
+		}
+		isUpdateHistory := true
+
+		if o.completer.IsInCompleteSelectMode() {
+			keepInCompleteMode = o.completer.HandleCompleteSelect(r)
+			if keepInCompleteMode {
+				continue
+			}
+
+			o.buf.Refresh(nil)
+			switch r {
+			case CharEnter, CharCtrlJ:
+				o.history.Update(o.buf.Runes(), false)
+				fallthrough
+			case CharInterrupt:
+				fallthrough
+			case CharBell:
+				continue
+			}
+		}
+
+		if o.vim.IsEnableVimMode() {
+			r = o.vim.HandleVim(r, func() rune {
+				r, err := o.t.GetRune(deadline)
+				if err == nil {
+					return r
+				} else {
+					return 0
+				}
+			})
+			if r == 0 {
+				continue
+			}
+		}
+
+		var result []rune
+
+		isTypingRune := false
+
+		switch r {
+		case CharBell:
+			if o.search.IsSearchMode() {
+				o.search.ExitSearchMode(true)
+				o.buf.Refresh(nil)
+			}
+			if o.completer.IsInCompleteMode() {
+				o.completer.ExitCompleteMode(true)
+				o.buf.Refresh(nil)
+			}
+		case CharBckSearch:
+			if !o.search.SearchMode(searchDirectionBackward) {
+				o.t.Bell()
+				break
+			}
+			keepInSearchMode = true
+		case CharCtrlU:
+			o.undo.add()
+			o.buf.KillFront()
+		case CharFwdSearch:
+			if !o.search.SearchMode(searchDirectionForward) {
+				o.t.Bell()
+				break
+			}
+			keepInSearchMode = true
+		case CharKill:
+			o.undo.add()
+			o.buf.Kill()
+			keepInCompleteMode = true
+		case MetaForward:
+			o.buf.MoveToNextWord()
+		case CharTranspose:
+			o.undo.add()
+			o.buf.Transpose()
+		case MetaBackward:
+			o.buf.MoveToPrevWord()
+		case MetaDelete:
+			o.undo.add()
+			o.buf.DeleteWord()
+		case CharLineStart:
+			o.buf.MoveToLineStart()
+		case CharLineEnd:
+			o.buf.MoveToLineEnd()
+		case CharBackspace, CharCtrlH:
+			o.undo.add()
+			if o.search.IsSearchMode() {
+				o.search.SearchBackspace()
+				keepInSearchMode = true
+				break
+			}
+
+			if o.buf.Len() == 0 {
+				o.t.Bell()
+				break
+			}
+			o.buf.Backspace()
+		case CharCtrlZ:
+			if !platform.IsWindows {
+				o.buf.Clean()
+				o.t.SleepToResume()
+				o.Refresh()
+			}
+		case CharCtrlL:
+			clearScreen(o.t)
+			o.buf.SetOffset(cursorPosition{1, 1})
+			o.Refresh()
+		case MetaBackspace, CharCtrlW:
+			o.undo.add()
+			o.buf.BackEscapeWord()
+		case MetaShiftTab:
+			// no-op
+		case CharCtrlY:
+			o.buf.Yank()
+		case CharCtrl_:
+			o.undo.undo()
+		case CharEnter, CharCtrlJ:
+			if o.search.IsSearchMode() {
+				o.search.ExitSearchMode(false)
+			}
+			if o.completer.IsInCompleteMode() {
+				o.completer.ExitCompleteMode(true)
+				o.buf.Refresh(nil)
+			}
+			o.buf.MoveToLineEnd()
+			var data []rune
+			o.buf.WriteRune('\n')
+			data = o.buf.Reset()
+			data = data[:len(data)-1] // trim \n
+			result = data
+			if !o.GetConfig().DisableAutoSaveHistory {
+				// ignore IO error
+				_ = o.history.New(data)
+			} else {
+				isUpdateHistory = false
+			}
+			o.undo.init()
+		case CharBackward:
+			o.buf.MoveBackward()
+		case CharForward:
+			o.buf.MoveForward()
+		case CharPrev:
+			buf := o.history.Prev()
+			if buf != nil {
+				o.buf.Set(buf)
+				o.undo.init()
+			} else {
+				o.t.Bell()
+			}
+		case CharNext:
+			buf, ok := o.history.Next()
+			if ok {
+				o.buf.Set(buf)
+				o.undo.init()
+			} else {
+				o.t.Bell()
+			}
+		case MetaDeleteKey, CharEOT:
+			o.undo.add()
+			// on Delete key or Ctrl-D, attempt to delete a character:
+			if o.buf.Len() > 0 || !o.IsNormalMode() {
+				if !o.buf.Delete() {
+					o.t.Bell()
+				}
+				break
+			}
+			if r != CharEOT {
+				break
+			}
+			// Ctrl-D on an empty buffer: treated as EOF
+			o.buf.WriteString(o.GetConfig().EOFPrompt + "\n")
+			o.buf.Reset()
+			isUpdateHistory = false
+			o.history.Revert()
+			o.buf.Clean()
+			return nil, io.EOF
+		case CharInterrupt:
+			if o.search.IsSearchMode() {
+				o.search.ExitSearchMode(true)
+				break
+			}
+			if o.completer.IsInCompleteMode() {
+				o.completer.ExitCompleteMode(true)
+				o.buf.Refresh(nil)
+				break
+			}
+			o.buf.MoveToLineEnd()
+			o.buf.Refresh(nil)
+			hint := o.GetConfig().InterruptPrompt + "\n"
+			o.buf.WriteString(hint)
+			remain := o.buf.Reset()
+			remain = remain[:len(remain)-len([]rune(hint))]
+			isUpdateHistory = false
+			o.history.Revert()
+			return nil, ErrInterrupt
+		case CharTab:
+			if o.GetConfig().AutoComplete != nil {
+				if o.completer.OnComplete() {
+					if o.completer.IsInCompleteMode() {
+						keepInCompleteMode = true
+						continue // redraw is done, loop
+					}
+				} else {
+					o.t.Bell()
+				}
+				o.buf.Refresh(nil)
+				break
+			} // else: process as a normal input character
+			fallthrough
+		default:
+			isTypingRune = true
+			if !isTyping {
+				o.undo.add()
+			}
+			if o.search.IsSearchMode() {
+				o.search.SearchChar(r)
+				keepInSearchMode = true
+				break
+			}
+			o.buf.WriteRune(r)
+			if o.completer.IsInCompleteMode() {
+				o.completer.OnComplete()
+				if o.completer.IsInCompleteMode() {
+					keepInCompleteMode = true
+				} else {
+					o.buf.Refresh(nil)
+				}
+			}
+		}
+
+		isTyping = isTypingRune
+
+		// suppress the Listener callback if we received Enter or similar and are
+		// submitting the result, since the buffer has already been cleared:
+		if result == nil {
+			if listener := o.GetConfig().Listener; listener != nil {
+				newLine, newPos, ok := listener(o.buf.Runes(), o.buf.Pos(), r)
+				if ok {
+					o.buf.SetWithIdx(newPos, newLine)
+				}
+			}
+		}
+
+		o.m.Lock()
+		if !keepInSearchMode && o.search.IsSearchMode() {
+			o.search.ExitSearchMode(false)
+			o.buf.Refresh(nil)
+			o.undo.init()
+		} else if o.completer.IsInCompleteMode() {
+			if !keepInCompleteMode {
+				o.completer.ExitCompleteMode(false)
+				o.refresh()
+				o.undo.init()
+			} else {
+				o.buf.Refresh(nil)
+				o.completer.CompleteRefresh()
+			}
+		}
+		if isUpdateHistory && !o.search.IsSearchMode() {
+			// it will cause null history
+			o.history.Update(o.buf.Runes(), false)
+		}
+		o.m.Unlock()
+
+		if result != nil {
+			return result, nil
+		}
+	}
+}
+
+func (o *operation) Stderr() io.Writer {
+	return o.wrapErr.Load()
+}
+
+func (o *operation) Stdout() io.Writer {
+	return o.wrapOut.Load()
+}
+
+func (o *operation) String() (string, error) {
+	r, err := o.Runes()
+	return string(r), err
+}
+
+func (o *operation) Runes() ([]rune, error) {
+	o.t.EnterRawMode()
+	defer o.t.ExitRawMode()
+
+	cfg := o.GetConfig()
+	listener := cfg.Listener
+	if listener != nil {
+		listener(nil, 0, 0)
+	}
+
+	// Before writing the prompt and starting to read, get a lock
+	// so we don't race with wrapWriter trying to write and refresh.
+	o.m.Lock()
+	o.isPrompting = true
+	// Query cursor position before printing the prompt as there
+	// may be existing text on the same line that ideally we don't
+	// want to overwrite and cause prompt to jump left.
+	// Bound the query: a pty that never answers the DSR request (expect,
+	// pexpect, Ansible with a pty, some CI runners) would otherwise block
+	// here forever and no prompt would ever be printed.
+	o.getAndSetOffset(newDSRDeadline())
+	o.buf.Print() // print prompt & buffer contents
+	// Prompt written safely, unlock until read completes and then
+	// lock again to unset.
+	o.m.Unlock()
+
+	if cfg.Undo {
+		o.undo = newOpUndo(o)
+	}
+
+	defer func() {
+		o.m.Lock()
+		o.isPrompting = false
+		o.buf.SetOffset(cursorPosition{1, 1})
+		o.m.Unlock()
+	}()
+
+	return o.readline(nil)
+}
+
+func (o *operation) getAndSetOffset(deadline chan struct{}) {
+	if !o.GetConfig().isInteractive || o.dsrUnsupported {
+		return
+	}
+
+	// Handle lineedge cases where existing text before before
+	// the prompt is printed would leave us at the right edge of
+	// the screen but the next character would actually be printed
+	// at the beginning of the next line.
+	// TODO ???
+	o.t.Write([]byte(" \b"))
+
+	offset, err := o.t.GetCursorPosition(deadline)
+	switch {
+	case err == nil:
+		o.buf.SetOffset(offset)
+	case errors.Is(err, deadlineExceeded):
+		// The terminal did not answer in time; assume it never will and
+		// stop querying, so the timeout is not paid before every prompt.
+		o.dsrUnsupported = true
+	}
+}
+
+// newDSRDeadline returns a channel that closes once dsrTimeout has elapsed,
+// bounding how long a cursor position query will wait for the terminal to
+// answer. On expiry GetCursorPosition returns an error, the offset is left
+// unchanged and the prompt is printed anyway.
+func newDSRDeadline() chan struct{} {
+	deadline := make(chan struct{})
+	time.AfterFunc(dsrTimeout, func() { close(deadline) })
+	return deadline
+}
+
+func (o *operation) GenPasswordConfig() *Config {
+	baseConfig := o.GetConfig()
+	return &Config{
+		EnableMask:      true,
+		InterruptPrompt: "\n",
+		EOFPrompt:       "\n",
+		HistoryLimit:    -1,
+
+		Stdin:  baseConfig.Stdin,
+		Stdout: baseConfig.Stdout,
+		Stderr: baseConfig.Stderr,
+
+		FuncIsTerminal:     baseConfig.FuncIsTerminal,
+		FuncMakeRaw:        baseConfig.FuncMakeRaw,
+		FuncExitRaw:        baseConfig.FuncExitRaw,
+		FuncOnWidthChanged: baseConfig.FuncOnWidthChanged,
+	}
+}
+
+func (o *operation) ReadLineWithConfig(cfg *Config) (string, error) {
+	backupCfg, err := o.SetConfig(cfg)
+	if err != nil {
+		return "", err
+	}
+	defer func() {
+		o.SetConfig(backupCfg)
+	}()
+	return o.String()
+}
+
+func (o *operation) SetTitle(t string) {
+	o.t.Write([]byte("\033[2;" + t + "\007"))
+}
+
+func (o *operation) Slice() ([]byte, error) {
+	r, err := o.Runes()
+	if err != nil {
+		return nil, err
+	}
+	return []byte(string(r)), nil
+}
+
+func (o *operation) Close() {
+	o.history.Close()
+}
+
+func (o *operation) IsNormalMode() bool {
+	return !o.completer.IsInCompleteMode() && !o.search.IsSearchMode()
+}
+
+func (op *operation) SetConfig(cfg *Config) (*Config, error) {
+	op.m.Lock()
+	defer op.m.Unlock()
+	old := op.t.GetConfig()
+	if err := cfg.init(); err != nil {
+		return old, err
+	}
+
+	// install the config in its canonical location (inside terminal):
+	op.t.SetConfig(cfg)
+
+	op.wrapOut.Store(&wrapWriter{target: cfg.Stdout, o: op})
+	op.wrapErr.Store(&wrapWriter{target: cfg.Stderr, o: op})
+
+	if op.history == nil {
+		op.history = newOpHistory(op)
+	}
+	if op.search == nil {
+		op.search = newOpSearch(op.buf.w, op.buf, op.history)
+	}
+
+	if cfg.AutoComplete != nil && op.completer == nil {
+		op.completer = newOpCompleter(op.buf.w, op)
+	}
+
+	return old, nil
+}
+
+func (o *operation) ResetHistory() {
+	o.history.Reset()
+}
+
+func (o *operation) SaveToHistory(content string) error {
+	return o.history.New([]rune(content))
+}
+
+func (o *operation) Refresh() {
+	o.m.Lock()
+	defer o.m.Unlock()
+	o.refresh()
+}
+
+func (o *operation) refresh() {
+	if o.isPrompting {
+		o.buf.Refresh(nil)
+	}
+}
diff --git a/vendor/github.com/ergochat/readline/readline.go b/vendor/github.com/ergochat/readline/readline.go
new file mode 100644
index 0000000..4d0d010
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/readline.go
@@ -0,0 +1,319 @@
+package readline
+
+import (
+	"io"
+	"os"
+	"os/signal"
+	"sync"
+	"syscall"
+
+	"github.com/ergochat/readline/internal/platform"
+)
+
+type Instance struct {
+	terminal  *terminal
+	operation *operation
+
+	closeOnce sync.Once
+	closeErr  error
+}
+
+type Config struct {
+	// Prompt is the input prompt (ANSI escape sequences are supported on all platforms)
+	Prompt string
+
+	// HistoryFile is the path to the file where persistent history will be stored
+	// (empty string disables).
+	HistoryFile string
+	// HistoryLimit is the maximum number of history entries to store. If it is 0
+	// or unset, the default value is 500; set to -1 to disable.
+	HistoryLimit           int
+	DisableAutoSaveHistory bool
+	// HistorySearchFold enables case-insensitive history searching.
+	HistorySearchFold bool
+
+	// AutoComplete defines the tab-completion behavior. See the documentation for
+	// the AutoCompleter interface for details.
+	AutoComplete AutoCompleter
+
+	// Listener is an optional callback to intercept keypresses.
+	Listener Listener
+
+	// Painter is an optional callback to rewrite the buffer for display.
+	Painter Painter
+
+	// FuncFilterInputRune is an optional callback to translate keyboard inputs;
+	// it takes in the input rune and returns (translation, ok). If ok is false,
+	// the rune is skipped.
+	FuncFilterInputRune func(rune) (rune, bool)
+
+	// VimMode enables Vim-style insert mode by default.
+	VimMode bool
+
+	InterruptPrompt string
+	EOFPrompt       string
+
+	EnableMask bool
+	MaskRune   rune
+
+	// Undo controls whether to maintain an undo buffer (if enabled,
+	// Ctrl+_ will undo the previous action).
+	Undo bool
+
+	// These fields allow customizing terminal handling. Most clients should ignore them.
+	Stdin              io.Reader
+	Stdout             io.Writer
+	Stderr             io.Writer
+	FuncIsTerminal     func() bool
+	FuncMakeRaw        func() error
+	FuncExitRaw        func() error
+	FuncGetSize        func() (width int, height int)
+	FuncOnWidthChanged func(func())
+
+	// private fields
+	inited        bool
+	isInteractive bool
+}
+
+func (c *Config) init() error {
+	if c.inited {
+		return nil
+	}
+	c.inited = true
+	if c.Stdin == nil {
+		c.Stdin = os.Stdin
+	}
+
+	if c.Stdout == nil {
+		c.Stdout = os.Stdout
+	}
+	if c.Stderr == nil {
+		c.Stderr = os.Stderr
+	}
+	if c.HistoryLimit == 0 {
+		c.HistoryLimit = 500
+	}
+
+	if c.InterruptPrompt == "" {
+		c.InterruptPrompt = "^C"
+	} else if c.InterruptPrompt == "\n" {
+		c.InterruptPrompt = ""
+	}
+	if c.EOFPrompt == "" {
+		c.EOFPrompt = "^D"
+	} else if c.EOFPrompt == "\n" {
+		c.EOFPrompt = ""
+	}
+
+	if c.FuncGetSize == nil {
+		c.FuncGetSize = platform.GetScreenSize
+	}
+	if c.FuncIsTerminal == nil {
+		c.FuncIsTerminal = platform.DefaultIsTerminal
+	}
+	rm := new(rawModeHandler)
+	if c.FuncMakeRaw == nil {
+		c.FuncMakeRaw = rm.Enter
+	}
+	if c.FuncExitRaw == nil {
+		c.FuncExitRaw = rm.Exit
+	}
+	if c.FuncOnWidthChanged == nil {
+		c.FuncOnWidthChanged = platform.DefaultOnSizeChanged
+	}
+	if c.Painter == nil {
+		c.Painter = defaultPainter
+	}
+
+	c.isInteractive = c.FuncIsTerminal()
+
+	return nil
+}
+
+// NewFromConfig creates a readline instance from the specified configuration.
+func NewFromConfig(cfg *Config) (*Instance, error) {
+	if err := cfg.init(); err != nil {
+		return nil, err
+	}
+	t, err := newTerminal(cfg)
+	if err != nil {
+		return nil, err
+	}
+	o := newOperation(t)
+	return &Instance{
+		terminal:  t,
+		operation: o,
+	}, nil
+}
+
+// NewEx is an alias for NewFromConfig, for compatibility.
+var NewEx = NewFromConfig
+
+// New creates a readline instance with default configuration.
+func New(prompt string) (*Instance, error) {
+	return NewFromConfig(&Config{Prompt: prompt})
+}
+
+func (i *Instance) ResetHistory() {
+	i.operation.ResetHistory()
+}
+
+func (i *Instance) SetPrompt(s string) {
+	cfg := i.GetConfig()
+	cfg.Prompt = s
+	i.SetConfig(cfg)
+}
+
+// readline will refresh automatic when write through Stdout()
+func (i *Instance) Stdout() io.Writer {
+	return i.operation.Stdout()
+}
+
+// readline will refresh automatic when write through Stdout()
+func (i *Instance) Stderr() io.Writer {
+	return i.operation.Stderr()
+}
+
+// switch VimMode in runtime
+func (i *Instance) SetVimMode(on bool) {
+	cfg := i.GetConfig()
+	cfg.VimMode = on
+	i.SetConfig(cfg)
+}
+
+func (i *Instance) IsVimMode() bool {
+	return i.operation.vim.IsEnableVimMode()
+}
+
+// GeneratePasswordConfig generates a suitable Config for reading passwords;
+// this config can be modified and then used with ReadLineWithConfig, or
+// SetConfig.
+func (i *Instance) GeneratePasswordConfig() *Config {
+	return i.operation.GenPasswordConfig()
+}
+
+func (i *Instance) ReadLineWithConfig(cfg *Config) (string, error) {
+	return i.operation.ReadLineWithConfig(cfg)
+}
+
+func (i *Instance) ReadPassword(prompt string) ([]byte, error) {
+	if result, err := i.ReadLineWithConfig(i.GeneratePasswordConfig()); err == nil {
+		return []byte(result), nil
+	} else {
+		return nil, err
+	}
+}
+
+// ReadLine reads a line from the configured input source, allowing inline editing.
+// The returned error is either nil, io.EOF, or readline.ErrInterrupt.
+func (i *Instance) ReadLine() (string, error) {
+	return i.operation.String()
+}
+
+// Readline is an alias for ReadLine, for compatibility.
+func (i *Instance) Readline() (string, error) {
+	return i.ReadLine()
+}
+
+// SetDefault prefills a default value for the next call to Readline()
+// or related methods. The value will appear after the prompt for the user
+// to edit, with the cursor at the end of the line.
+func (i *Instance) SetDefault(defaultValue string) {
+	i.operation.SetBuffer(defaultValue)
+}
+
+func (i *Instance) ReadLineWithDefault(defaultValue string) (string, error) {
+	i.SetDefault(defaultValue)
+	return i.operation.String()
+}
+
+// SaveToHistory adds a string to the instance's stored history. This is particularly
+// relevant when DisableAutoSaveHistory is configured.
+func (i *Instance) SaveToHistory(content string) error {
+	return i.operation.SaveToHistory(content)
+}
+
+// same as readline
+func (i *Instance) ReadSlice() ([]byte, error) {
+	return i.operation.Slice()
+}
+
+// Close() closes the readline instance, cleaning up state changes to the
+// terminal. It interrupts any concurrent Readline() operation, so it can be
+// asynchronously or from a signal handler. It is concurrency-safe and
+// idempotent, so it can be called multiple times.
+func (i *Instance) Close() error {
+	i.closeOnce.Do(func() {
+		// TODO reorder these?
+		i.operation.Close()
+		i.closeErr = i.terminal.Close()
+	})
+	return i.closeErr
+}
+
+// CaptureExitSignal registers handlers for common exit signals that will
+// close the readline instance.
+func (i *Instance) CaptureExitSignal() {
+	cSignal := make(chan os.Signal, 1)
+	// TODO handle other signals in a portable way?
+	signal.Notify(cSignal, os.Interrupt, syscall.SIGTERM)
+	go func() {
+		for range cSignal {
+			i.Close()
+		}
+	}()
+}
+
+// Write writes output to the screen, redrawing the prompt and buffer
+// as needed.
+func (i *Instance) Write(b []byte) (int, error) {
+	return i.Stdout().Write(b)
+}
+
+// GetConfig returns a copy of the current config.
+func (i *Instance) GetConfig() *Config {
+	cfg := i.operation.GetConfig()
+	result := new(Config)
+	*result = *cfg
+	return result
+}
+
+// SetConfig modifies the current instance's config.
+func (i *Instance) SetConfig(cfg *Config) error {
+	_, err := i.operation.SetConfig(cfg)
+	return err
+}
+
+// Refresh redraws the input buffer on screen.
+func (i *Instance) Refresh() {
+	i.operation.Refresh()
+}
+
+// DisableHistory disables the saving of input lines in history.
+func (i *Instance) DisableHistory() {
+	i.operation.history.Disable()
+}
+
+// EnableHistory enables the saving of input lines in history.
+func (i *Instance) EnableHistory() {
+	i.operation.history.Enable()
+}
+
+// ClearScreen clears the screen.
+func (i *Instance) ClearScreen() {
+	clearScreen(i.operation.Stdout())
+}
+
+// Painter is a callback type to allow modifying the buffer before it is rendered
+// on screen, for example, to implement real-time syntax highlighting.
+type Painter func(line []rune, pos int) []rune
+
+func defaultPainter(line []rune, _ int) []rune {
+	return line
+}
+
+// Listener is a callback type to listen for keypresses while the line is being
+// edited. It is invoked initially with (nil, 0, 0), and then subsequently for
+// any keypress until (but not including) the newline/enter keypress that completes
+// the input.
+type Listener func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)
diff --git a/vendor/github.com/ergochat/readline/runebuf.go b/vendor/github.com/ergochat/readline/runebuf.go
new file mode 100644
index 0000000..2d27df3
--- /dev/null
+++ b/vendor/github.com/ergochat/readline/runebuf.go
@@ -0,0 +1,684 @@
+package readline
+
+import (
+	"bufio"
+	"bytes"
+	"fmt"
+	"io"
+	"strings"
+	"sync"
+
+	"github.com/ergochat/readline/internal/runes"
+)
+
+type runeBuffer struct {
+	buf []rune
+	idx int
+	w   *terminal
+
+	cpos cursorPosition
+	ppos int // prompt start position (0 == column 1)
+
+	lastKill []rune
+
+	sync.Mutex
+}
+
+func (r *runeBuffer) pushKill(text []rune) {
+	r.lastKill = append([]rune{}, text...)
+}
+
+func newRuneBuffer(w *terminal) *runeBuffer {
+	rb := &runeBuffer{
+		w: w,
+	}
+	return rb
+}
+
+func (r *runeBuffer) CurrentWidth(x int) int {
+	r.Lock()
+	defer r.Unlock()
+	return runes.WidthAll(r.buf[:x])
+}
+
+func (r *runeBuffer) PromptLen() int {
+	r.Lock()
+	defer r.Unlock()
+	return r.promptLen()
+}
+
+func (r *runeBuffer) promptLen() int {
+	return runes.WidthAll(runes.ColorFilter([]rune(r.prompt())))
+}
+
+func (r *runeBuffer) RuneSlice(i int) []rune {
+	r.Lock()
+	defer r.Unlock()
+
+	if i > 0 {
+		rs := make([]rune, i)
+		copy(rs, r.buf[r.idx:r.idx+i])
+		return rs
+	}
+	rs := make([]rune, -i)
+	copy(rs, r.buf[r.idx+i:r.idx])
+	return rs
+}
+
+func (r *runeBuffer) Runes() []rune {
+	r.Lock()
+	newr := make([]rune, len(r.buf))
+	copy(newr, r.buf)
+	r.Unlock()
+	return newr
+}
+
+func (r *runeBuffer) Pos() int {
+	r.Lock()
+	defer r.Unlock()
+	return r.idx
+}
+
+func (r *runeBuffer) Len() int {
+	r.Lock()
+	defer r.Unlock()
+	return len(r.buf)
+}
+
+func (r *runeBuffer) MoveToLineStart() {
+	r.Refresh(func() {
+		r.idx = 0
+	})
+}
+
+func (r *runeBuffer) MoveBackward() {
+	r.Refresh(func() {
+		if r.idx == 0 {
+			return
+		}
+		r.idx--
+	})
+}
+
+func (r *runeBuffer) WriteString(s string) {
+	r.WriteRunes([]rune(s))
+}
+
+func (r *runeBuffer) WriteRune(s rune) {
+	r.WriteRunes([]rune{s})
+}
+
+func (r *runeBuffer) getConfig() *Config {
+	return r.w.GetConfig()
+}
+
+func (r *runeBuffer) isInteractive() bool {
+	return r.getConfig().isInteractive
+}
+
+func (r *runeBuffer) prompt() string {
+	return r.getConfig().Prompt
+}
+
+func (r *runeBuffer) WriteRunes(s []rune) {
+	r.Lock()
+	defer r.Unlock()
+
+	if r.idx == len(r.buf) {
+		// cursor is already at end of buf data so just call
+		// append instead of refesh to save redrawing.
+		r.buf = append(r.buf, s...)
+		r.idx += len(s)
+		if r.isInteractive() {
+			r.append(s)
+		}
+	} else {
+		// writing into the data somewhere so do a refresh
+		r.refresh(func() {
+			tail := append(s, r.buf[r.idx:]...)
+			r.buf = append(r.buf[:r.idx], tail...)
+			r.idx += len(s)
+		})
+	}
+}
+
+func (r *runeBuffer) MoveForward() {
+	r.Refresh(func() {
+		if r.idx == len(r.buf) {
+			return
+		}
+		r.idx++
+	})
+}
+
+func (r *runeBuffer) IsCursorInEnd() bool {
+	r.Lock()
+	defer r.Unlock()
+	return r.idx == len(r.buf)
+}
+
+func (r *runeBuffer) Replace(ch rune) {
+	r.Refresh(func() {
+		r.buf[r.idx] = ch
+	})
+}
+
+func (r *runeBuffer) Erase() {
+	r.Refresh(func() {
+		r.idx = 0
+		r.pushKill(r.buf[:])
+		r.buf = r.buf[:0]
+	})
+}
+
+func (r *runeBuffer) Delete() (success bool) {
+	r.Refresh(func() {
+		if r.idx == len(r.buf) {
+			return
+		}
+		r.pushKill(r.buf[r.idx : r.idx+1])
+		r.buf = append(r.buf[:r.idx], r.buf[r.idx+1:]...)
+		success = true
+	})
+	return
+}
+
+func (r *runeBuffer) DeleteWord() {
+	if r.idx == len(r.buf) {
+		return
+	}
+	init := r.idx
+	for init < len(r.buf) && runes.IsWordBreak(r.buf[init]) {
+		init++
+	}
+	for i := init + 1; i < len(r.buf); i++ {
+		if !runes.IsWordBreak(r.buf[i]) && runes.IsWordBreak(r.buf[i-1]) {
+			r.pushKill(r.buf[r.idx : i-1])
+			r.Refresh(func() {
+				r.buf = append(r.buf[:r.idx], r.buf[i-1:]...)
+			})
+			return
+		}
+	}
+	r.Kill()
+}
+
+func (r *runeBuffer) MoveToPrevWord() (success bool) {
+	r.Refresh(func() {
+		if r.idx == 0 {
+			return
+		}
+
+		for i := r.idx - 1; i > 0; i-- {
+			if !runes.IsWordBreak(r.buf[i]) && runes.IsWordBreak(r.buf[i-1]) {
+				r.idx = i
+				success = true
+				return
+			}
+		}
+		r.idx = 0
+		success = true
+	})
+	return
+}
+
+func (r *runeBuffer) KillFront() {
+	r.Refresh(func() {
+		if r.idx == 0 {
+			return
+		}
+
+		length := len(r.buf) - r.idx
+		r.pushKill(r.buf[:r.idx])
+		copy(r.buf[:length], r.buf[r.idx:])
+		r.idx = 0
+		r.buf = r.buf[:length]
+	})
+}
+
+func (r *runeBuffer) Kill() {
+	r.Refresh(func() {
+		r.pushKill(r.buf[r.idx:])
+		r.buf = r.buf[:r.idx]
+	})
+}
+
+func (r *runeBuffer) Transpose() {
+	r.Refresh(func() {
+		if r.idx == 0 {
+			// match the GNU Readline behavior, Ctrl-T at the start of the line
+			// is a no-op:
+			return
+		}
+
+		// OK, we have at least one character behind us:
+		if r.idx < len(r.buf) {
+			// swap the character in front of us with the one behind us
+			r.buf[r.idx], r.buf[r.idx-1] = r.buf[r.idx-1], r.buf[r.idx]
+			// advance the cursor
+			r.idx++
+		} else if r.idx == len(r.buf) && len(r.buf) >= 2 {
+			// swap the two characters behind us
+			r.buf[r.idx-2], r.buf[r.idx-1] = r.buf[r.idx-1], r.buf[r.idx-2]
+			// leave the cursor in place since there's nowhere to go
+		}
+	})
+}
+
+func (r *runeBuffer) MoveToNextWord() {
+	r.Refresh(func() {
+		for i := r.idx + 1; i < len(r.buf); i++ {
+			if !runes.IsWordBreak(r.buf[i]) && runes.IsWordBreak(r.buf[i-1]) {
+				r.idx = i
+				return
+			}
+		}
+
+		r.idx = len(r.buf)
+	})
+}
+
+func (r *runeBuffer) MoveToEndWord() {
+	r.Refresh(func() {
+		// already at the end, so do nothing
+		if r.idx == len(r.buf) {
+			return
+		}
+		// if we are at the end of a word already, go to next
+		if !runes.IsWordBreak(r.buf[r.idx]) && runes.IsWordBreak(r.buf[r.idx+1]) {
+			r.idx++
+		}
+
+		// keep going until at the end of a word
+		for i := r.idx + 1; i < len(r.buf); i++ {
+			if runes.IsWordBreak(r.buf[i]) && !runes.IsWordBreak(r.buf[i-1]) {
+				r.idx = i - 1
+				return
+			}
+		}
+		r.idx = len(r.buf)
+	})
+}
+
+func (r *runeBuffer) BackEscapeWord() {
+	r.Refresh(func() {
+		if r.idx == 0 {
+			return
+		}
+		for i := r.idx - 1; i >= 0; i-- {
+			if i == 0 || (runes.IsWordBreak(r.buf[i-1])) && !runes.IsWordBreak(r.buf[i]) {
+				r.pushKill(r.buf[i:r.idx])
+				r.buf = append(r.buf[:i], r.buf[r.idx:]...)
+				r.idx = i
+				return
+			}
+		}
+
+		r.buf = r.buf[:0]
+		r.idx = 0
+	})
+}
+
+func (r *runeBuffer) Yank() {
+	if len(r.lastKill) == 0 {
+		return
+	}
+	r.Refresh(func() {
+		buf := make([]rune, 0, len(r.buf)+len(r.lastKill))
+		buf = append(buf, r.buf[:r.idx]...)
+		buf = append(buf, r.lastKill...)
+		buf = append(buf, r.buf[r.idx:]...)
+		r.buf = buf
+		r.idx += len(r.lastKill)
+	})
+}
+
+func (r *runeBuffer) Backspace() {
+	r.Refresh(func() {
+		if r.idx == 0 {
+			return
+		}
+
+		r.idx--
+		r.buf = append(r.buf[:r.idx], r.buf[r.idx+1:]...)
+	})
+}
+
+func (r *runeBuffer) MoveToLineEnd() {
+	r.Lock()
+	defer r.Unlock()
+	if r.idx == len(r.buf) {
+		return
+	}
+	r.refresh(func() {
+		r.idx = len(r.buf)
+	})
+}
+
+// LineCount returns number of lines the buffer takes as it appears in the terminal.
+func (r *runeBuffer) LineCount() int {
+	sp := r.getSplitByLine(r.buf, 1)
+	return len(sp)
+}
+
+func (r *runeBuffer) MoveTo(ch rune, prevChar, reverse bool) (success bool) {
+	r.Refresh(func() {
+		if reverse {
+			for i := r.idx - 1; i >= 0; i-- {
+				if r.buf[i] == ch {
+					r.idx = i
+					if prevChar {
+						r.idx++
+					}
+					success = true
+					return
+				}
+			}
+			return
+		}
+		for i := r.idx + 1; i < len(r.buf); i++ {
+			if r.buf[i] == ch {
+				r.idx = i
+				if prevChar {
+					r.idx--
+				}
+				success = true
+				return
+			}
+		}
+	})
+	return
+}
+
+func (r *runeBuffer) isInLineEdge() bool {
+	sp := r.getSplitByLine(r.buf, 1)
+	return len(sp[len(sp)-1]) == 0 // last line is 0 len
+}
+
+func (r *runeBuffer) getSplitByLine(rs []rune, nextWidth int) [][]rune {
+	tWidth, _ := r.w.GetWidthHeight()
+	cfg := r.getConfig()
+	if cfg.EnableMask {
+		w := runes.Width(cfg.MaskRune)
+		masked := []rune(strings.Repeat(string(cfg.MaskRune), len(rs)))
+		return runes.SplitByLine(runes.ColorFilter([]rune(r.prompt())), masked, r.ppos, tWidth, w)
+	} else {
+		return runes.SplitByLine(runes.ColorFilter([]rune(r.prompt())), rs, r.ppos, tWidth, nextWidth)
+	}
... 25695 lines suppressed ...