pmbootstrap-meow/helpers/pmbootstrap-autocompletion.zsh
Oliver Smith 6bb8444fef
"...flasher flash_rootfs" instead of "..._system" (#1373)
* Change `pmbootstrap flasher flash_system` command to
  `pmbootstrap flasher flash_rootfs`
* The old command still works, but all references have been changed to
  the new command
* Remove obsolete `pmbootstrap flasher export` (that was changed to
  `pmbootstrap export` a few months ago)
* Update `README.md` and ZSH auto completion
* Change the description of the generated rootfs image (not talking
  about a system image anymore, mention that it has subpartitions)
* Better description of `pmbootstrap flasher flash_rootfs --partition`
2018-03-30 01:11:20 +00:00

66 lines
1.5 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_check|menuconfig)
ls -1 $PMBOOTSTRAP_DIR/aports/*/ | grep linux- \
| sed 's/linux-//g'
;;
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