pmbootstrap-meow/helpers/pmbootstrap-autocompletion.zsh
steamport 30df0725ca menuconfig: add gconfig/xconfig support (#1509)
* change "pmbootstrap kconfig_check" to "pmbootstrap kconfig check"
* change "pmbootstrap menuconfig" to "pmbootstrap kconfig edit [-x|-g]"
  (with legacy alias, because the first syntax was referenced to a lot)
* enable X11 interfaces: -x: xconfig, -g: gconfig
* new function to copy the xauthority file:
  pmb.chroot.other.copy_xauthority()
* remove menufconfig() function from the kernel template and all kernel
  aports ([skip ci] because it would rebuild all kernels and run out of
  time). Alpine has dropped this as well, and it wouldn't work with the
  new code anyway.
2018-06-09 06:52:24 +00:00

65 lines
1.4 KiB
Bash

#!zsh
# Installation:
#
# Copy this file to ~/.zsh/ (create it, if it doesn't exist, or put it
# somewhere that makes sense to you). Then, insert the following line
# in your ~/.zshrc (making sure to use the right folder name, if changed):
#
# source ~/.zsh/pmbootstrap-auto-completion.zsh
#
# Then, set the variable PMBOOTSTRAP_DIR to your `pmbootstrap` root.
# Example:
#
# PMBOOTSTRAP_DIR=/home/axel/Git/pmbootstrap
#
# This file is rudimentary, pmbootstrap actions and packages are autocompleted
# so far. Further ideas for improvements are here:
# <https://github.com/postmarketOS/pmbootstrap/pull/1232>
PMBOOTSTRAP_DIR=
_pmbootstrap_commands()
{
grep '^def ' $PMBOOTSTRAP_DIR/pmb/helpers/frontend.py | cut -d ' ' -f 2 \
| cut -d '(' -f 1 | grep -v '^_'
}
_pmbootstrap_targets()
{
case $1 in
build|checksum|pkgrel_bump)
find $PMBOOTSTRAP_DIR/aports/ -mindepth 2 -maxdepth 2 -type d \
-printf '%f\n' | sed "s|$PMBOOTSTRAP_DIR/aports/||g"
;;
kconfig)
echo edit check
;;
flasher)
echo boot flash_kernel flash_rootfs sideload list_flavors \
list_devices
;;
esac
}
_pmbootstrap()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
'1: :->command'\
'2: :->target'
case $state in
command)
compadd `_pmbootstrap_commands`
;;
target)
compadd `_pmbootstrap_targets $line[1]`
;;
esac
}
if [ -f $PMBOOTSTRAP_DIR/pmbootstrap.py ]; then
compdef _pmbootstrap pmbootstrap
fi