From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105854 invoked by alias); 17 Jan 2019 20:29:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 105835 invoked by uid 89); 17 Jan 2019 20:29:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=CLI X-HELO: gateway36.websitewelcome.com Received: from gateway36.websitewelcome.com (HELO gateway36.websitewelcome.com) (50.116.126.2) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Jan 2019 20:29:53 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 1570840132C42 for ; Thu, 17 Jan 2019 13:42:26 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id kEIQgtgo12PzOkEIQgVoB7; Thu, 17 Jan 2019 14:29:50 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hSEbqQq+Tqpvsts21/xhASpiyLrgDCGNbd9/hU5yphk=; b=wGBvGveUgO8uyM7Xf8N7gJusai emul3At8DfENJ+qL40X6EpIBvBpg1i9WkfhOffN4xRa0ZFLx1xpqIoWvISRNME2+smPIY6KPgmXq0 u/elKdBU4exawcap8t9BTBk39; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:46828 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gkEIQ-004HXV-Lt; Thu, 17 Jan 2019 14:29:50 -0600 From: Tom Tromey To: Jan Vrany Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] MI: Add new command -complete References: <20190103222930.4365-1-jan.vrany@fit.cvut.cz> Date: Thu, 17 Jan 2019 20:29:00 -0000 In-Reply-To: <20190103222930.4365-1-jan.vrany@fit.cvut.cz> (Jan Vrany's message of "Thu, 3 Jan 2019 22:29:30 +0000") Message-ID: <87imynm3ia.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-01/txt/msg00413.txt.bz2 >>>>> "Jan" == Jan Vrany writes: Jan> This commit adds a new '-complete' MI command which is implemented using Jan> CLI's 'complete'. I suspect it would be better to just write a new MI function and then mildly refactor complete_command so that the two commands can share most of their implementation. First, this would make it so we could add options to the MI command as needed. (Perhaps the current argument to the command ought to have a flag to avoid future parsing problems? I am not sure.) Second, it would mean that we could make changes to the CLI command without worrying about breaking MI compatibility. What do you think of this? I looked and I see that some other MI commands are implemented directly by CLI commands. I am not sure but I suspect this might be a deprecated approach. Jan> + bool is_mi_like = uiout->is_mi_like_p (); This could be removed by having a more explicit API. Jan> + ui_out_emit_list completions_emitter (uiout, "completions"); Jan> + if (result.number_matches != 0) Jan> + { Jan> + if (result.number_matches == 1) Jan> + { Jan> + if (is_mi_like) Jan> + uiout->field_fmt(NULL, "%s%s", arg_prefix.c_str (), Jan> + result.match_list[0]); Jan> + else Jan> + printf_unfiltered ("%s%s\n", arg_prefix.c_str (), Jan> + result.match_list[0]); Space before "(" in the field_fmt call. Unifying the cases would be preferable. Or another argument for separation. thanks, Tom