19146: Remove unneeded special case checks, explain the needed one.
[arvados.git] / lib / deduplicationreport / command.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package deduplicationreport
6
7 import (
8         "io"
9
10         "git.arvados.org/arvados.git/lib/cmd"
11         "git.arvados.org/arvados.git/sdk/go/ctxlog"
12 )
13
14 var Command command
15
16 type command struct{}
17
18 // RunCommand implements the subcommand "deduplication-report <collection> <collection> ..."
19 func (command) RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
20         var err error
21         logger := ctxlog.New(stderr, "text", "info")
22         defer func() {
23                 if err != nil {
24                         logger.WithError(err).Error("fatal")
25                 }
26         }()
27
28         logger.SetFormatter(cmd.NoPrefixFormatter{})
29
30         exitcode := report(prog, args, logger, stdout, stderr)
31
32         return exitcode
33 }