From a6e4f87bc7643be63b959435d0298ec7a82acd36 Mon Sep 17 00:00:00 2001 From: Hernan Grecco Date: Wed, 12 Mar 2014 14:28:20 -0300 Subject: [PATCH] Implemented an optional parameter (attr) in 'camtool claims' to filter by claim type For example, to obtain all the versions for a given file use: $ camtool claims --attr="camliContent" Change-Id: Ibb267a0f95702faa0e7e763c99f99ee446559aac --- cmd/camtool/claims.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/camtool/claims.go b/cmd/camtool/claims.go index abf72c618..09fa4ea65 100644 --- a/cmd/camtool/claims.go +++ b/cmd/camtool/claims.go @@ -29,12 +29,14 @@ import ( type claimsCmd struct { server string + attr string } func init() { cmdmain.RegisterCommand("claims", func(flags *flag.FlagSet) cmdmain.CommandRunner { cmd := new(claimsCmd) flags.StringVar(&cmd.server, "server", "", "Server to fetch claims from. "+serverFlagHelp) + flags.StringVar(&cmd.attr, "attr", "", "Filter claims about a specific attribute. If empty, all claims are returned.") return cmd }) } @@ -44,7 +46,7 @@ func (c *claimsCmd) Describe() string { } func (c *claimsCmd) Usage() { - fmt.Fprintf(os.Stderr, "Usage: camtool [globalopts] claims [--depth=n] permanodeBlobRef\n") + fmt.Fprintf(os.Stderr, "Usage: camtool [globalopts] claims [--depth=n] [--attr=s] permanodeBlobRef\n") } func (c *claimsCmd) Examples() []string { @@ -61,7 +63,8 @@ func (c *claimsCmd) RunCommand(args []string) error { } cl := newClient(c.server) res, err := cl.GetClaims(&search.ClaimsRequest{ - Permanode: br, + Permanode: br, + AttrFilter: c.attr, }) if err != nil { return err