From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gM4bNrZr12DgcgAAgWs5BA (envelope-from ) for ; Sat, 26 Jun 2021 20:02:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id GDjEMbZr12DJPQAAbx9fmQ (envelope-from ) for ; Sat, 26 Jun 2021 18:02:30 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0DEEA1C03D for ; Sat, 26 Jun 2021 20:02:30 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 04B68290C9; Sat, 26 Jun 2021 14:02:27 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 2A7F9290C4 for ; Sat, 26 Jun 2021 14:02:24 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:35546) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxCdK-0000ta-N2; Sat, 26 Jun 2021 14:02:22 -0400 Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:44604 helo=osgiliath.local) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxCdJ-0008Ma-1C; Sat, 26 Jun 2021 14:02:22 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH 1/5] CLI/show: accept --sort Date: Sat, 26 Jun 2021 19:02:07 +0100 Message-Id: <20210626180211.341012-1-jao@gnu.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210626022846.233052-1-jao@gnu.org> References: <20210626022846.233052-1-jao@gnu.org> MIME-Version: 1.0 Message-ID-Hash: QTI2UTUZBA5644UTYZ7KE2NBUW3FPQFJ X-Message-ID-Hash: QTI2UTUZBA5644UTYZ7KE2NBUW3FPQFJ X-MailFrom: jao@gnu.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jao X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624730550; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=59Nazay7eTxbhg1Sa8eJJEPv3gNRSeqMs6JllGebNOc=; b=TUahqjZqaF1JRmQrWQyXEfFHuBcRyWUmyfz6bj8ZJddm/3WcJPGe3JfVZ1h5NarNOd3434 iEY1/kfRHqIHRdfiulWvE4JL4CumFYJmulYWkZd2Y2jZu/xeGYcmMkRicoKTWiobO5y+cu DNZ4ZlYOED7awC5oNRWX4F+8v3q2dQaZ+66r7bxY8DSKGfehR869+FBdmWd4FyZNZlZri0 ALlqQLsr0k9llUHu0rs1unLjD0uCoHIO3kSEAPYTf3A+xnkyszKWwqh06LkhaPhUuoQTZR YREaXhIyzCxyJhDXpRRV4luYlim2JgfkHPDZD+uPugumHktOBFQh1ouDVfCIow== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624730550; a=rsa-sha256; cv=none; b=bc47Yxsn0vOZvAsEZ7Xp8ubmNzVKuD0Ru7QvduhuxBAXsoAsmoFg6OAUvz/PK6JehuPpB5 syS0UdDM/JbredN1QgnDIlKaDk8ko2zP0KQ8/6wzuarrAZOfZTAh1wp8GJZo4AQmJtgqqu zjH6WSCIpt04/4mDmhp8YgV3tAwPVYNvSRPag/ypyUeFUMXxbl3Jnb6NN8oLsDkmJ+tisW nIrYmt/2HfuBDRLwtAv03Xtn9HQTC/oaaPI9zq+Ze7So61D7AH8q+zjmFWyKMniKl7P5Nd c6Ass+iH2G1C7R1s2CHAnml96XIenZx/k7yYfJJd4sQu/KmZVmeR2tazv30mkA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gnu.org (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.96 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gnu.org (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 0DEEA1C03D X-Spam-Score: -0.96 X-Migadu-Scanner: scn0.migadu.com X-TUID: D5b6/CsXunKH Add the command-line option --sort to the show command of the CLI notmuch interface, with the same possible values as the same option in notmuch search. --- notmuch-show.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/notmuch-show.c b/notmuch-show.c index bdb87321..947ffa8d 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -1244,8 +1244,13 @@ notmuch_show_command (notmuch_database_t *notmuch, int argc, char *argv[]) bool single_message; bool unthreaded = FALSE; notmuch_status_t status; + int sort = NOTMUCH_SORT_NEWEST_FIRST; notmuch_opt_desc_t options[] = { + { .opt_keyword = &sort, .name = "sort", .keywords = + (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST }, + { "newest-first", NOTMUCH_SORT_NEWEST_FIRST }, + { 0, 0 } } }, { .opt_keyword = &format, .name = "format", .keywords = (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON }, { "text", NOTMUCH_FORMAT_TEXT }, @@ -1362,6 +1367,8 @@ notmuch_show_command (notmuch_database_t *notmuch, int argc, char *argv[]) return EXIT_FAILURE; } + notmuch_query_set_sort (query, sort); + /* Create structure printer. */ formatter = formatters[format]; sprinter = formatter->new_sprinter (notmuch, stdout); -- 2.32.0