From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5627 invoked from network); 4 Sep 2023 06:33:23 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Sep 2023 06:33:23 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1693809204; b=eo9+N0icjzlm6rcZd1tmQgYD15UYhusQbqZuSY5QF/SAMMTTtYLtq+6nko/+BCXSSO016UExcd 3FdVFj28EHvNPwecCmmOby90X/DmkvChZDw3FqM7LIaNyD9rct56Xvz6T5geyyxCBdAT0Jsjri zYW56SnQUSKQNojCBt/o6BU982Ms3tZCae8UBt0oCDd2a+XAa0XM+ySls8jL+p+M3V3nK/5W7+ YRt6H6lG3cY76kgZf80Oxgetj42JzABUABHhYc5gzua2tUdvWogWVjzywsieI+ZsVm8iGbzi/J E4T+u4svPDG7C3hk7yu0HzOh9qt3Q/gpW1VB1T7wy6nWng==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd00007-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.7; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1693809204; bh=GRmczGMLEf3SERiM4w1b1/O5brjT3ft2g7DpekI2uUQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:To:Date:Message-ID:Subject:MIME-Version: Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=Ai34HFVTJTu86u+NU1HfqAXKlfpadJHjsvvKqR0as+z6S2oSlqPbMuVrzdQC0q5WJpkoni+5ml SfUvR4CkxoAcuyLPlhzR+mEePAoD0o2KlWOPuRfJOZUPB+1/nz0Ud/DZvz+LOWk3nv+o2SCzQw C8ivry8BdVzGhNp0pa02BoY+CVhz5ppA4EOhU8im2ERshA0sKVKsAj4swQXuQCRtkXOxXXf03r x2J+muh05EACl1RJ1gWovbaizjAA7blPgMsS+Z9dQtOEiG5jF1tpk7D6ubvI4TaQ4bq/2bLwQt JaQZq1ITNRG3skNp8KtBpzkSi01pmcyAiAFOxHnkDt6yAQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:To:Date:Message-Id:Subject: Mime-Version:Content-Transfer-Encoding:Content-Type:From:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=xs0gLVxYiQM5dYAmVAttUSFcLSZfgs0Pm/8E28irE9I=; b=OzmOP5HdRByHIhXC4lickKwzhu Cia0C6NjcFpO98igFpN0kw+LToy2dkKx4LgJMcMdTjXMNfA1Mffc1JffS5ON6hc39qg84bgB7hVW6 ciiZ//yPWAURvHnVLlvVmfMKJT6qpoy2ej9rN4DBCJpvBG/Vlc6QTrpy1bXXuaO6R9WgKUX+WrI+I f4N4+5rteqxZNZC5tg2RTJjeF7Ewb8+TYkdI/oxqMBEIxRoRhK3lYjx0q4yjJ0gx0jhIdjkfxkpFW 6s0A4MuG3pDVB/BTPkwE8+xUHnhUiMz7dPoTPfvN9eS2ov44hEszcIuGyJ6GFN7vOGU5LcJpgbZJ6 4jZTI9zQ==; Received: by zero.zsh.org with local id 1qd39G-000A2r-J8; Mon, 04 Sep 2023 06:33:22 +0000 Authentication-Results: zsh.org; iprev=pass (snd00007-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.7; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd00007-bg.im.kddi.ne.jp ([27.86.113.7]:41313 helo=dfmta0021.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1qd38e-0009iE-LI; Mon, 04 Sep 2023 06:32:47 +0000 Received: from mail.biglobe.ne.jp by omta0021.biglobe.ne.jp with ESMTP id <20230904063238652.KEPI.17547.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Mon, 4 Sep 2023 15:32:38 +0900 From: "Jun. T" Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.3\)) Subject: [PATCH] improve _nice Message-Id: Date: Mon, 4 Sep 2023 15:32:38 +0900 To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.3696.120.41.1.3) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 52114 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Currently _nice dose not complete any options and % nice - gives % nice - This is for skipping obsolete options such as -10. With the patch below non-obsolete options are completed in the above case. User can still specify the obsolete option manually. diff --git a/Completion/Unix/Command/_nice b/Completion/Unix/Command/_nice index 29070697f..b52e5216a 100644 --- a/Completion/Unix/Command/_nice +++ b/Completion/Unix/Command/_nice @@ -1,14 +1,23 @@ #compdef nice -shift words -(( CURRENT-- )) +local -a specs=( '*:: : _normal -p $service' ) -if [[ $CURRENT -gt 1 && $words[1] = ([-+](-|)|-n)<-> ]]; then - shift words - (( CURRENT -- )) -elif [[ $CURRENT -gt 2 && $words[1] = -n ]]; then - shift 2 words - (( CURRENT -= 2 )) +# See if the 1st arg is such as -10 --10 or -+10 +if [[ $words[2] = -(-|+|)[0-9]## ]]; then + if (( $CURRENT == 2 )); then + _message 'niceness increment' && return + fi + compset -n 2 # Ignore the 1st arg +else + if _pick_variant gnu=GNU unix --version; then + specs+=( + '(-)'{-n+,--adjustment=}'[adjust niceness]:niceness increment' + '(* -)--help[display help and exit]' + '(* -)--version[output version information and exit]' + ) + else + specs+=( '-n+[specify increment of niceness]:niceness increment' ) + fi fi -_normal +_arguments : $specs