Warning, file /plasma/plasma-workspace/completions/plasmashell.zsh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #compdef plasmashell
0002 
0003 # SPDX-FileCopyrightText: 2022 ivan tkachenko <me@ratijas.tk>
0004 #
0005 # SPDX-License-Identifier: GPL-2.0-or-later
0006 
0007 # keep this function in sync with plasmoidviewer from plasma-sdk
0008 function _plasma_list_packages() {
0009   local expl global_dir descr="$1" purpose="$2" type="${3:-Plasma/Applet}"
0010   local -a packages containments
0011   # Then strip " -- " prefix and " *" suffix (i.e. everything after and including first whitespace).
0012   # (@) array Expansion Flags are needed because we need to operate on each element separately.
0013   packages=( ${(f)"$(
0014     _call_program plasma-list-packages \
0015       kpackagetool5 --type "$type" --list --global
0016     )"} )
0017   # First line is an output header, it contains path where plugins are probed.
0018   global_dir="${${${packages[1]}##* in }%/}"
0019   packages[1]=()
0020 
0021   if [[ "$purpose" == "containment" ]]; then
0022     # No need to get jq involved. We simply look for a magic string, which
0023     # hopefully won't be named literally in any other irrelevant field.
0024     containments=( ${${${(f)"$(
0025       # Glob Qualifiers (.) and (@r) match plain files and readable symbolic links;
0026       # (N) sets the NULL_GLOB option for the current pattern, so it doesn't print
0027       # an error for non-existent and empty directories.
0028       grep --files-with-matches -R "Plasma/Containment" $global_dir/*/metadata.json(N.,@r)
0029     )"}#$global_dir/}%/metadata.json} )  # strip back prefix and suffix
0030     packages=( $containments )  # directory name is the package id
0031   else
0032     # Don't filter containments out in an 'else' branch: they might be perfectly
0033     # executable applets on their own, e.g. org.kde.plasma.folder view.
0034   fi
0035 
0036   _wanted "$descr" expl "$purpose" \
0037     compadd -a packages
0038 }
0039 
0040 _arguments -s \
0041   '(- *)'{-h,--help}'[Displays help on commandline options]' \
0042   '(- *)'{-v,--version}'[Displays version information]' \
0043   '(- *)--feedback[Lists the available options for user feedback]' \
0044   '(-d --qmljsdebugger)'{-d,--qmljsdebugger}'[Enable QML Javascript debugger]' \
0045   '--replace[Replace an existing instance]' \
0046   '(-n --no-respawn)'{-n,--no-respawn}'[Do not restart plasma-shell automatically after a crash]' \
0047   '(-a --standalone)'{-a,--standalone}'[Load plasmashell as a standalone application, needs the shell-plugin option to be specified]' \
0048   '(-p --shell-plugin)'{-p=,--shell-plugin=}'[Force loading the given shell plugin]::: _plasma_list_packages plugins "shell plugin" Plasma/Shell' \
0049   '--test=[Enables test mode and specifies the layout javascript file to set up the testing environment]::layout javascript file:_files -g "*.js"'