Code Monkey home page Code Monkey logo

lazycomplete's Introduction

lazycomplete

Lazy loading for shell completion scripts.

A lot of programs provide their own shell completion script by invoking them with a specific argument like mybinary completion. The easiest way to use it is to add the call to the shell init script (like .bashrc) which keeps the completion up to date. Add a couple of these and shell startup time is affected considerably though as a single invocation and subsequent parsing can take ~50-100ms. This tool generates a lazy loading script for given binaries where the actual completion script is resolved only when needed.

Status

WIP

Usage

Invoke with pairs of binary name and command to be invoked to create the completion:

# bash
source <(lazycomplete \
  example 'example _carapace' \
  lab 'lab _carapace' \
)

# elvish
eval (lazycomplete ^
  example 'example _carapace' ^
  lab 'lab _carapace' ^
|slurp)


# fish
lazycomplete \
  example 'example _carapace' \
  lab 'lab _carapace' \
| source

# oil
source <(lazycomplete \
  example 'example _carapace' \
  lab 'lab _carapace' \
)

# powershell
lazycomplete `
  example 'example _carapace' `
  lab 'lab _carapace' `
| Out-String | Invoke-Expression

# xonsh
exec($(lazycomplete \
  example 'example _carapace' \
  lab 'lab _carapace' \
))

# zsh
source <(lazycomplete \
  example 'example _carapace' \
  lab 'lab _carapace' \
)

lazycomplete's People

Contributors

rsteube avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

sarvex

lazycomplete's Issues

Bash complains about 'default: command not found' on first run

I configured lazycomplete for several bash completions, as in

source <(lazycomplete \                                                                            
    kubectl 'kubectl completion bash' \
)

The first time it tries to autocomplete bash complains.

$ kubectl <TAB>bash: default: command not found

Press tab again and completion seems to work as expected.

  • lazycomplete: 0.0.18
  • bash: 5.2.2(1)-release

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.