systemd-run revision 8d2bc8e5fd023a24684446f0057440e3fd0d79bf
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas# systemd-run(1) completion -*- shell-script -*-
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek# This file is part of systemd.
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek# Copyright 2013 Zbigniew Jędrzejewski-Szmek
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek# systemd is free software; you can redistribute it and/or modify it
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek# under the terms of the GNU Lesser General Public License as published by
2c12a402cb1e8277c271ced8dc9c06d20b8f6017Zbigniew Jędrzejewski-Szmek# the Free Software Foundation; either version 2.1 of the License, or
2c12a402cb1e8277c271ced8dc9c06d20b8f6017Zbigniew Jędrzejewski-Szmek# (at your option) any later version.
2c12a402cb1e8277c271ced8dc9c06d20b8f6017Zbigniew Jędrzejewski-Szmek# systemd is distributed in the hope that it will be useful, but
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas# WITHOUT ANY WARRANTY; without even the implied warranty of
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas# General Public License for more details.
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas# You should have received a copy of the GNU Lesser General Public License
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas# along with systemd; If not, see <http://www.gnu.org/licenses/>.
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas__systemctl() {
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas local mode=$1; shift 1
299c397c127cda34facbe7d089f944a708ec95e9Zbigniew Jędrzejewski-Szmek systemctl $mode --full --no-legend "$@"
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas__get_slice_units () { __systemctl $1 list-units --all -t slice \
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas | { while read -r a b c d; do echo " $a"; done; }; }
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas__get_machines() {
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; };
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek local OPTS='-h --help --version --user --system --scope --unit --description --slice
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek -r --remain-after-exit --send-sighup -H --host -M --machine --service-type
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek --on-active --on-boot --on-startup --on-unit-active --on-unit-inactive
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek --on-calendar --timer-property -t --pty -q --quiet --no-block
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek --uid --gid --nice --setenv -p --property --no-ask-password'
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas local mode=--system
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas local opts_with_values=(
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas --unit --description --slice --service-type -H --host -M --machine -p --property --on-active
26bd71f06c842585b184c3c2f29376564102232dRonny Chevalier --on-boot --on-startup --on-unit-active --on-unit-inactive --on-calendar --timer-property
26bd71f06c842585b184c3c2f29376564102232dRonny Chevalier for (( i=1; i <= COMP_CWORD; i++ )); do
26bd71f06c842585b184c3c2f29376564102232dRonny Chevalier if [[ ${COMP_WORDS[i]} != -* ]]; then
26bd71f06c842585b184c3c2f29376564102232dRonny Chevalier local root_command=${COMP_WORDS[i]}
26bd71f06c842585b184c3c2f29376564102232dRonny Chevalier _command_offset $i
26bd71f06c842585b184c3c2f29376564102232dRonny Chevalier [[ ${COMP_WORDS[i]} == "--user" ]] && mode=--user
2c12a402cb1e8277c271ced8dc9c06d20b8f6017Zbigniew Jędrzejewski-Szmek [[ $i -lt $COMP_CWORD && " ${opts_with_values[@]} " =~ " ${COMP_WORDS[i]} " ]] && ((i++))