From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 4Nx3EQaR1mCpiwAAgWs5BA (envelope-from ) for ; Sat, 26 Jun 2021 04:29:26 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 0GwzDQaR1mBoYQAAB5/wlQ (envelope-from ) for ; Sat, 26 Jun 2021 02:29:26 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (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 D5BDD80C4 for ; Sat, 26 Jun 2021 04:29:25 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id CF3B6290BE; Fri, 25 Jun 2021 22:29:11 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 3842E2903E for ; Fri, 25 Jun 2021 22:29:02 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:43846) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwy44-00007c-NN; Fri, 25 Jun 2021 22:29:00 -0400 Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:37900 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 1lwy44-0003CZ-EP; Fri, 25 Jun 2021 22:29:00 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH 1/7] CLI/show: accept --sort Date: Sat, 26 Jun 2021 03:28:40 +0100 Message-Id: <20210626022846.233052-2-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: GDLLQSR6PGJRGMSP2OIRDX27X7V447UJ X-Message-ID-Hash: GDLLQSR6PGJRGMSP2OIRDX27X7V447UJ 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=1624674565; 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=JkKITJnZqOZoNZBegf/l8kzOLoR0c8NhrZqAdextjy+ivk/qs+mDYu1z/KNZmTwelvHurh EmlCnL4Yj1FvE36MzxadxyZ06QqpJImC1TCFq1OidJR7ccrspGMGPGqpJboVz1Y/i7J9rR V6pdyuTG7mu9vG2ZydeEZ819nehrn/yHKiTS712VzUBk8GGjoD/vTNv+rowo/P3q+QYkZm AnH8H1mDK37OqIaGOgwYv+llM+BzdSyDrguqujZLGzw8I3h/DEoEUT/+U7vTYUDisgWDLQ yVX+0QT26j/i0nztrdF/MBz0Gg8yA+bXLU++aNegVy5rWLhUeUyUIZlw8pnzTw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624674565; a=rsa-sha256; cv=none; b=YSh/zaT3A8x1GKvc1wyzXoZz+J4UzylGugonIzfaMryZfiKjzfcddoBJYbHdz04d21B2gO 1iAwPlb5fXA3a3rMXw9sukZBMZ+ktIOYQOHXFicIpsxcFHw4sK6DDc0/Z99xuQOlA6dgUl nX4rKS+VFVH/bqcv2HPZH2lKM49IEN+j4SNxRy/ht5IkDmL1El/kYOJ70KBLVMen3BhTP5 mzFwd+Nkg3eoejbn2CPa2efPOEfixwr/kQbXFCLY0sGE6BXVEa038fSGC11yJJtszuTZtU w657TdC43qOoE880f5ZY6vIghxJ5fMiRJV0Ig5cDbTQw4Gp4Hm84AZ01uOS+SA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.90 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 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: D5BDD80C4 X-Spam-Score: -0.90 X-Migadu-Scanner: scn0.migadu.com X-TUID: kJRfGKZajfH6 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