From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28072 invoked by alias); 30 Mar 2018 14:07:00 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42568 Received: (qmail 27550 invoked by uid 1010); 30 Mar 2018 14:07:00 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(-1.4/5.0):. Processed in 13.719257 secs); 30 Mar 2018 14:07:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=g5DA=GU=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1522418798; bh=TME650NFyq+YJZSQp80lR7/obTtKnRNOMWVSsblVLvA=; h=From:To:Subject:Date:From:Subject; b=hp3yWSipon6SgdW8xlAwzxs7JwnV6lRMyN3tEOKg6gql44y9CvihAdFvLglWYmSfmJS9vjkmjLUmRz0s+JvOVP1MdQ2cUPi3NuipjPPFcix7KJ4Hevd40Y87nEHBQcBXFq2TJWxrVbNHgQztx2gFhZbhEv9PzWW6R2sPwZFxW70nkkMbiiHL5dUNvo8x2iQipxZIYsV9F5I/SlGFz+oVhMW/LgcoSdJyxq+xDbUc7wZ1cKgDrkN+RmIUWfcUb/75casdP8LmEmWXwQc4wfOlJrng/0/1T58NvqvtCSTcAbACY3LqofbBRBLHKPfKIHiaHCnqVknPuY2IDmOrqauOGA== X-YMail-OSG: 32c6ltwVM1mKG6yANX9GATNg9R3gub5XEO5sYgkM7nlbfWGkjpmrS1qbsVgEBG9 l6VTbYsU3YwF3U8JYq4yfEgLCtyInB3Yj0mWbEgf5TZUgXyL4EBf2S4dAw.RvHHSNtlRuIqVEBxr XcDn4g.FYBS0xt.HPpR66aIGahiVSf9FHZiCVdx0vzxTF9AVcZYSdWurDtlR0o8JSf_TPsU4VZz. stPT3YJJ8E3ilbyg9Je51eOE37G_aUU3hZ4ToN6wjak1KHJxDt5ckKZwtFlZ36fr5PGF3Doqt_Ry pcfwtLm5.nAuxK44c5jjUqFH6it7lpsGGuQdPn5tJJbeCMFvWMJOuauc_6ce8oxRXv.2N4YxXwAv QXer9z13D4nFrrIjX2In7ZYCrEaNEyATxaCRGstDh5gs8rmeY7utazH_CqAdC6gy5szSIqfmVG0Y J0eQyWW6eZ1pxC.ETXyjd7y2NZfKDzUU19Y6lbFPV9uYyQ7OKD8g1YYeOqpxsAV.roObeZVNbklz bnwsQRmCoaQ-- From: Oliver Kiddle To: Zsh workers Subject: PATCH: shutdown completion MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18405.1522407738.1@thecus> Date: Fri, 30 Mar 2018 13:02:18 +0200 Message-ID: <18406.1522407738@thecus> There's a shutdown completion in the zsh-completions project but it is system specific. This one handles the major BSDs and Solaris. On Linux, shutdown tends to come from the init system. systemd is handled otherwise you only get the most common BSD-style options. Oliver diff --git a/Completion/Unix/Command/_shutdown b/Completion/Unix/Command/_shutdown new file mode 100644 index 000000000..1ac6e61ba --- /dev/null +++ b/Completion/Unix/Command/_shutdown @@ -0,0 +1,61 @@ +#compdef shutdown + +local -a args + +if [[ -d /etc/systemd ]]; then + _arguments \ + '--help[display usage information]' \ + '(-H --halt)'{-H,--halt}'[halt the machine]' \ + '(-P --poweroff -h)'{-P,--poweroff,-h}'[power-off the machine (default)]' \ + '(-r --reboot)'{-r,--reboot}'[reboot the machine]' \ + "(--no-wall)-k[don't shutdown, just write wall message]" \ + "(-k)--no-wall[don't send a wall message]" \ + '-c[cancel pending shutdown]' \ + '1: :_guard "^-*" "time (now/hh\:mm/+mins)"' \ + '*:warning message' + return +fi + +case $OSTYPE in + *bsd*|dragonfly*|linux*) + args=( + '-h[halt the system after shutdown]' + '-p[turn off power after shutdown]' + '-r[reboot the system]' + '-k[kick everybody off]' + '-n[prevent file system cache from being flushed]' + '1: :_guard "^-*" "time (now/hh\:mm/+mins)"' + '*:warning message' + ) + ;| + (net|open)bsd*) + args+=( + '-d[cause system to perform a dump]' + '-f[create /fastboot so that file systems will not be checked during the next boot]' + ) + ;| + freebsd*|dragonfly*) + args+=( + '-o[execute halt or reboot instead of sending a signal to init]' + ) + ;; + netbsd*) + args+=( + '-b[specify boot string to pass to reboot]:boot string' + '-v[enable verbose console messages]' + '-x[enable debug console messages]' + '-z[silence some console messages]' + '-D[prevent shutdown from detaching from the tty]' + ) + ;; + solaris2.<11->) args=( '(-i)-r[reboot]' ) ;& + solaris*) + args+=( + '(-r)-i+[specify init-state]:init state:((0\:stop 1\:administrative s\:single\ user 5 6\:reboot))' + '-y[pre-answer yes to confirmation question]' + '-g+[specify grace period]:grace period (seconds) [60]' + ) + ;; +esac + +_arguments $args