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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8827 invoked from network); 7 May 2022 02:26:41 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 May 2022 02:26:41 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1651890401; b=KRDpQnOTsqdS+LbMG5zyHmrQW8/+R5BKhqC0IOH2VZm+sN7VclvWjbxcayelJtFH/oQfz9Vw90 j8C8/VKGgWJzLVA66g8lruGIX9uSC4kB87fviEgbrRYXmAoMt8oUJvQeDS5Ri5YP+gCMcRtiXK ocC/XOZu4eMt68DBU9lX7SOdBpo8UkOv/ZQrficV3n/FFd/usUH7kgEDoXTpWCPoIVRGpFlh6V vsgNMnbcf/XDvpMaUY6MzOZMJGnkykKsduDV792ceqwS6YQMLC09X1dO8alNAy447CLqHyfvNB Z8g+aFtvISX15Uj30QG6bj5k2ENe2tyYII5p6nd7nW8EgQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wout1-smtp.messagingengine.com) smtp.remote-ip=64.147.123.24; dkim=pass header.d=dana.is header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=dana.is; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1651890401; bh=LZbRCCnqDQ4CHZ5F2WAXIRGM0EwLuWPhfT3xeYFhFVs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Subject:To:From:Date:Message-ID:MIME-Version: DKIM-Signature:DKIM-Signature:DKIM-Signature; b=d/GL8WpJwzS2XhCWgC+Bwhv8+9fwq1fTkq8Zwt/WHtXtUOcu6BZa/RR53nK/zL0OY3bIt7j6eR gPNvmsP16nD5CK3lzMbAh8GnPdTYJcSmpmirR5YR3GlrusfltQ1aHTYA83y8bzZh2v1Titcfx0 4x7mdiaFwyhHus04w9epJVAQR4N2QJeX1Jjw5Ki7lZ+oIICbTHVKk4XXw6ez2h/SADD8bnRGey EyucOGCYzJl+QFTKQApHgt0tPmoX80rmWChO3jO0bQDGpGGi1UIy9P/oU+S+wruGWthWh2FCZ9 D20+cgnt8oKKxXLaF7/5fLO9q7+RNUaXyoskGlkx+orUjw==; 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:Content-Type:Subject:To:From:Date: Message-Id:Mime-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=uoMMw64wXxgSEDpITILccQ9rJwIJ682d6Vn87MNmuAI=; b=LIYUM7luSdWXGynNQif1Ac2E+s GQ6YfSTeWpqDHl1LbrOGOHyFM18fHGMGqVPDw6iQ9XEiaiWL6RUCWUH0K+htL5giNccTpQupm3pkJ VDwuTDBGxhNEnTGOM0JYPjAjlMAZPbRf3acmDjkXesxmVX1+X5N4h6ejJahxg/H+eb0EB6UuOduXR Yg7ePzLiObZONuhsQoDBp0uUOUzPluxoQdF9vHW/lr/Cr6a6i88qToYuh9qdMoIPOMkVD7X1ikLR+ hHlB+gErEARUXFyvBdgMsnmtVyeVqPBYZIyTdbSvJbQ+WSQ2oW/t0UhIrroquEMLzkxxZtTL34ryx LTaBYzbg==; Received: from authenticated user by zero.zsh.org with local id 1nnA9X-0001tb-Fe; Sat, 07 May 2022 02:26:39 +0000 Authentication-Results: zsh.org; iprev=pass (wout1-smtp.messagingengine.com) smtp.remote-ip=64.147.123.24; dkim=pass header.d=dana.is header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=dana.is; arc=none Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:56869) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1nnA8h-0001Yf-Iq; Sat, 07 May 2022 02:25:49 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 51BC63200A02 for ; Fri, 6 May 2022 22:25:45 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute5.internal (MEProxy); Fri, 06 May 2022 22:25:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana.is; h=cc :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t= 1651890344; x=1651976744; bh=uoMMw64wXxgSEDpITILccQ9rJwIJ682d6Vn 87MNmuAI=; b=eoaBTMi8dZPF9mBG0aHpsGNZ3rF33hK9XDAUhtZQct6QrphWgIO 0o7r1tj4Q0FCd39H8+Hu1dKs43bTcwPTeTEe3WvEONHe6oat8Sj1loGf/hzfCK0v p9Q4YIhTjH8/EH21CX9JMYXpJJ+/p+LbFeSNJ2V6E6meCdMSiqJDExDIQHwBa6kU iMkhOA5aQUJkws/bAXwRNks0p2f++V+BcKWVcdLc5q6jJjJqT8HmOoFqI6njgyiG l+1xGsx2QKyXlN60kOdheFz4h7xzLKmp/YuU5gy7KlHm2BHBUYOudV5xIBcFoATA VOxyeahAyTILr8K78eYd3V2YbI6vubQVIZg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1651890344; x=1651976744; bh=uoMMw64wXxgSE DpITILccQ9rJwIJ682d6Vn87MNmuAI=; b=foIUsnP32gXCi55VgowNgvvfDi73J fM9K/Zow0JarQi150I3Qd8kPqWmj4nb1WVIYajdvCWUvl8XCA1/JfCbJIh0eKaE7 3+ph/Z8Q0Cty+eh5yzWQw3szj5EDeh2HsdwzcXwqF1XWUAIpqzRc1WPk5x5ggLNp mfrIYf7Pp+W9hhloxH+WLilwNZkP7WsxNrbjaktFM98aNwXNg1ZGjt4GBs1a3FZz d9lRXdZLLXFsZy7xtoJ8oM+o6+1XddGib96Dvx7zDA37G58DOQs6XXw/o/vgdHyz PszQ0rPjoDNhDNJHKkr48CpDiKuePrmLylQDTT/bTOCZnNyBS5e60LLJA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeggdehhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkfffhvffutgesthdtredtre ertdenucfhrhhomhepuggrnhgruceouggrnhgrsegurghnrgdrihhsqeenucggtffrrght thgvrhhnpeegieethffhteevteeuffehvefgjefhffegudeileffleeigedtudfhffelje ejjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegu rghnrgesuggrnhgrrdhish X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 9465E170005C; Fri, 6 May 2022 22:25:44 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-591-gfe6c3a2700-fm-20220427.001-gfe6c3a27 Mime-Version: 1.0 Message-Id: <77cc388c-7acc-40ad-bd59-40b3d2bc4f29@www.fastmail.com> Date: Fri, 06 May 2022 21:25:24 -0500 From: dana To: "Zsh hackers list" Subject: [PATCH] Improve _htop Content-Type: text/plain X-Seq: 50176 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: [PATCH] Improve _htop Someone submitted a PR on GitHub (#89) to fix htop's --version short-hand amongst other things. There were a few trivial issues with the change as well as some existing bugs/omissions that it didn't account for, so i said i'd use the PR as a basis for a more elaborate improvement. Here's that finally. With their permission i'll probably commit it in the original author's name Are we holding back completion improvements like this until after 5.9 is released? (See also Marlon's patch from workers/49954) Changes: * Corrected -v to -V * Made -u argument optional * Enabled option stacking * Improved descriptions (added ranges+defaults, &c.) * Fixed broken sort keys with htop 3.x and added new key descriptions * Removed _sequence limit on -p (it was incorrect on non-Linux systems, and making it correct seems like too much work for a limit that probably nobody will ever hit) * Added several missing options dana diff --git a/Completion/Linux/Command/_htop b/Completion/Linux/Command/_htop index 28c7512bf..6635181bc 100644 --- a/Completion/Linux/Command/_htop +++ b/Completion/Linux/Command/_htop @@ -1,11 +1,56 @@ -#compdef htop - -_arguments -S : \ - '(-d --delay)'{-d+,--delay=}'[update frequency]:duration (tenths of seconds)' \ - '(-C --no-color --no-colour)'{-C,--no-colo{,u}r}'[monochrome mode]' \ - '(-)'{-h,--help}'[display usage information]' \ - \*{-p+,--pid=}'[show given pids]: : _sequence -n ${$(sort-keys' + '(-t --tree)'{-t,--tree}'[show tree view of processes]' + '(-u --user)'{-u+,--user=}'[show only processes of current or specified user]:: : _users' + '(-U --no-unicode)'{-U,--no-unicode}'[disable Unicode]' + '(-)'{-V,--version}'[display version information]' +) + +[[ $OSTYPE == linux* ]] && +(( ! EUID || $+_comp_priv_prefix )) && +_pick_variant libcap=drop-capabilities $OSTYPE --help && +args+=( + '--drop-capabilities=-[drop specified capabilties]::mode [basic]:(( + off\:"do not drop capabilities" + basic\:"drop capabilities not needed for standard functionality (retains kill, renice, etc.)" + strict\:"drop capabilities not needed for core functionality" + ))' +) + +_arguments -s -S : $args && ret=0 + +case $state in + sort-keys) + tmp=( ${(f)"$(_call_program sort-keys $words[1] --sort-key help)"} ) + tmp=( ${tmp/#[[:space:]]##} ) + tmp=( ${tmp//:/\\:} ) + tmp=( ${tmp/[[:space:]]##/:} ) + tmp=( ${tmp/(#m):[A-Z]/${(L)MATCH}} ) + _describe -t sort-keys 'column (key)' tmp && ret=0 + ;; +esac + +return ret