Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 2.44 KB

README.md

File metadata and controls

72 lines (51 loc) · 2.44 KB

Zsh bitbake completion

CI Badge GitHub Latest Release)

This plugins adds completion for the bitbake and devtool command line tools in the Z shell.

Installation

  • oh-my-zsh:

    • Clone this repository in $HOME/.oh-my-zsh/custom/plugins/:

      git clone https://github.com/antznin/zsh-bitbake.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"/plugins/zsh-bitbake
    • Add zsh-bitbake to the plugins array in your zshrc file:

      plugins=(... zsh-bitbake)
  • To install the plugin separately, clone this repository and source bitbake.plugin.zsh in your zshrc. Then add this repository's path to the completion path:

    source ".../zsh-bitbake/bitbake.plugin.zsh"
    fpath+=".../zsh-bitbake"
    autoload -U compinit
    compinit

Configuration

  • ZSH_BITBAKE_DISABLE_RECIPE_COMPLETION: an initial command is run to create a text file listing all available recipes in the current bitbake environment. The file is located in $BUILDDIR/.recipe-cache.

    This can take a while depending on the state the build environment. To disable this feature, set ZSH_BITBAKE_DISABLE_RECIPE_COMPLETION to any value in your zshrc.

How it works

Completion of arguments works normally as any other zsh completion, with additional suggestions when possible (common bitbake tasks, debug domains…).

Completion of recipes works differently as it depends on the environment. When trying to complete a recipe for the first time in the current environment, the bitbake-layers show-recipes command is run to fetch the complete list of recipes.

This command execution has a few requirements (not run and quietly exited if unmet):

  • ZSH_BITBAKE_DISABLE_RECIPE_COMPLETION is not set (see Configuration).

  • BUILDDIR is a directory. This variable is set by the oe-init-build-env script.

  • Commands bitbake-layers, sed, and tail exist in the current shell.

This creates a file $BUILDDIR/.recipe-cache that stores the list of recipes. Recipes are read from this file to enable completion. This file is not automatically updated if recipes are added or removed in the current environment (it would be too slow and costly). File must be removed to be regenerated on the next completion.