From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 0265B138A87 for ; Mon, 23 Feb 2015 00:06:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 049DDE0951; Mon, 23 Feb 2015 00:05:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AB98CE0951 for ; Mon, 23 Feb 2015 00:05:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C2CBF340C12 for ; Mon, 23 Feb 2015 00:05:39 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C0D4412580 for ; Mon, 23 Feb 2015 00:05:36 +0000 (UTC) From: "Alex Legler" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alex Legler" Message-ID: <1424649920.d3a8004768e26095748003e7932ea500b26eaa6a.a3li@gentoo> Subject: [gentoo-commits] proj/ag:master commit in: /, lib/ X-VCS-Repository: proj/ag X-VCS-Files: ag lib/storage.rb X-VCS-Directories: lib/ / X-VCS-Committer: a3li X-VCS-Committer-Name: Alex Legler X-VCS-Revision: d3a8004768e26095748003e7932ea500b26eaa6a X-VCS-Branch: master Date: Mon, 23 Feb 2015 00:05:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 5354788c-2a6c-48de-9650-3c7f2476421c X-Archives-Hash: 34c026586c5e897050c7cf614560cf2b commit: d3a8004768e26095748003e7932ea500b26eaa6a Author: Alex Legler a3li li> AuthorDate: Mon Feb 23 00:05:20 2015 +0000 Commit: Alex Legler gentoo org> CommitDate: Mon Feb 23 00:05:20 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=d3a80047 Implement --delete TODO: Actually delete the message --- ag | 8 +++++++- lib/storage.rb | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ag b/ag index 29ee0f2..dbb1584 100755 --- a/ag +++ b/ag @@ -142,7 +142,13 @@ def do_incremental end def do_delete - abort 'Come back later.' + id = Ag::Utils.resolve_id + + begin + Ag::Storage.delete($options.name, id) + rescue => e + $stderr.puts "Cannot delete message: #{e}" + end end def do_reindex diff --git a/lib/storage.rb b/lib/storage.rb index b4a518e..f255633 100644 --- a/lib/storage.rb +++ b/lib/storage.rb @@ -220,6 +220,11 @@ module Ag::Storage result['hits']['total'] end + + def delete(list, id) + $es.delete(index: 'ml-' + list, type: 'message', id: id) + end + def get(list, id) result = $es.search( index: 'ml-' + list,