systemd-analyze revision a72d698d0d9ff9c158155b44cdc77376df31a317
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# systemd-analyze(1) completion -*- shell-script -*-
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# This file is part of systemd.
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# Copyright 2010 Ran Benita
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# Copyright 2013 Harald Hoyer
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# systemd is free software; you can redistribute it and/or modify it
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# under the terms of the GNU Lesser General Public License as published by
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# the Free Software Foundation; either version 2.1 of the License, or
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# (at your option) any later version.
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# systemd is distributed in the hope that it will be useful, but
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# WITHOUT ANY WARRANTY; without even the implied warranty of
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# General Public License for more details.
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# You should have received a copy of the GNU Lesser General Public License
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder# along with systemd; If not, see <http://www.gnu.org/licenses/>.
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder__contains_word () {
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder local w word=$1; shift
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder for w in "$@"; do
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder [[ $w = "$word" ]] && return
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder_systemd_analyze() {
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder local i verb comps
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder local OPTS='--help --version --system --user --from-pattern --to-pattern --order --require'
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder local -A VERBS=(
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder [NO_OPTION]='time blame plot'
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder [CRITICAL_CHAIN]='critical-chain'
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder _init_completion || return
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder for ((i=0; $i <= $COMP_CWORD; i++)); do
c6b11bbe64a712a10d5d9e58152a7dba35edd056Christian Maeder if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&