From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Antero Mejr via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66551: [PATCH] Add completion for Unix 'doas' command. Date: Sun, 15 Oct 2023 11:29:29 +0000 Message-ID: <87bkd0jf8m.fsf@mailbox.org> References: <87sf6c90s5.fsf@mailbox.org> Reply-To: Antero Mejr Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10722"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66551@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 15 13:31:10 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qrzKt-0002cB-KB for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 Oct 2023 13:31:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrzKT-0008G5-M5; Sun, 15 Oct 2023 07:30:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrzKQ-0008Fn-5k for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2023 07:30:39 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrzKP-00048X-Nl for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2023 07:30:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qrzKn-0002Sk-QW for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2023 07:31:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Antero Mejr Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Oct 2023 11:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66551 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66551-submit@debbugs.gnu.org id=B66551.16973694101647 (code B ref 66551); Sun, 15 Oct 2023 11:31:01 +0000 Original-Received: (at 66551) by debbugs.gnu.org; 15 Oct 2023 11:30:10 +0000 Original-Received: from localhost ([127.0.0.1]:51366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qrzJx-0000Pc-TX for submit@debbugs.gnu.org; Sun, 15 Oct 2023 07:30:10 -0400 Original-Received: from mout-p-201.mailbox.org ([2001:67c:2050:0:465::201]:33640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qrzJt-0008Kn-5y for 66551@debbugs.gnu.org; Sun, 15 Oct 2023 07:30:09 -0400 Original-Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4S7dLh2Dg2z9smg; Sun, 15 Oct 2023 13:29:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1697369372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+DwVdYFmEXDf4xHdrytEwU2UxbQEBMfj3ksfxguM7b0=; b=mTPi/xvh5wgDLhSDR8gJPbYfXcnDgbSG7V5QZP4Z8DMUDuliBKFtIWmJpOaE/SpwMwkQdK DcQTk6wBxJaTZxkijm+Su0aTDwvIQHU7R/mNYVhUCzZqGXgTIeKLj+bY/EgJra3hTkRCf9 Z7jms8ABb486SeHvHaS/mgfFgyKa6kHw05x/dcxOlw7ZDeNtvrruFPLqwQgHZG5+dMoIBM s0jZT+cbUncW4EChx09ut8taHPgp8qgfRjy1SVbxlWUavqJi+qhSgDFledw7Hmy/kWeEha NXsChj3REq/HMZl1uZxAjinPMGGj6dLw/P5Wm2kcmnEfwHqvEYQly5K3wiczzQ== In-Reply-To: (Stefan Kangas's message of "Sun, 15 Oct 2023 00:58:04 -0700") X-MBO-RS-META: x77jqby794g8po9z6a35d1q9uy1sqarm X-MBO-RS-ID: 1b9914c3e0da3e8aca0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:272504 Archived-At: --=-=-= Content-Type: text/plain Stefan Kangas writes: >> +;;;###autoload >> +(defun pcomplete/doas () >> + "Completion for the `doas' command." >> + (pcomplete-opt "su") > > Are there any other options that are worth adding? > > https://man.openbsd.org/doas > The options "su" are the flags shared across BSD, Linux, and eshell-builtin versions of doas. The revised patch (attached) has all flags from the BSD version, but will provide completions for invalid flags for Linux and eshell doas. BSD and Linux doas doesn't have a -h/--help flag, so I don't think we can get the flags using pcomplete-from-help unfortunately. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-completion-for-Unix-doas-command.patch >From 2519752ca39cfe8786a65dd3caca98a689b24777 Mon Sep 17 00:00:00 2001 From: Antero Mejr Date: Sun, 15 Oct 2023 00:32:57 +0000 Subject: [PATCH] Add completion for Unix 'doas' command. * lisp/pcmpl-unix.el (pcomplete/doas): New procedure. * etc/NEWS: Announce. (Bug#66551) --- etc/NEWS | 4 ++++ lisp/pcmpl-unix.el | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 3bd47a0112b..d73ec031d85 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -477,6 +477,10 @@ When this option is non-nil, remote file names are not completed by Pcomplete. Packages, like 'shell-mode', could set this in order to suppress remote file name completion at all. +--- +*** Completions for the Unix 'doas' command are now provided. +Command completion for 'doas' in Eshell and Shell mode will now work. + ** Shell Mode +++ diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el index e6b67256a4c..15462637df1 100644 --- a/lisp/pcmpl-unix.el +++ b/lisp/pcmpl-unix.el @@ -685,6 +685,14 @@ Includes files as well as host names followed by a colon." (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1)) pcomplete-default-completion-function))) +;;;###autoload +(defun pcomplete/doas () + "Completion for the `doas' command." + (pcomplete-opt "aCLnsu") + (funcall pcomplete-command-completion-function) + (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1)) + pcomplete-default-completion-function))) + (provide 'pcmpl-unix) ;;; pcmpl-unix.el ends here -- 2.41.0 --=-=-=--