1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
14 "git.curoverse.com/arvados.git/lib/cli"
15 "git.curoverse.com/arvados.git/lib/cmd"
20 cmdVersion cmd.Handler = versionCmd{}
21 handler = cmd.Multi(map[string]cmd.Handler{
23 "version": cmdVersion,
24 "-version": cmdVersion,
25 "--version": cmdVersion,
32 "pipeline": cli.Pipeline,
37 "api_client_authorization": cli.APICall,
38 "api_client": cli.APICall,
39 "authorized_key": cli.APICall,
40 "collection": cli.APICall,
41 "container": cli.APICall,
42 "container_request": cli.APICall,
46 "job_task": cli.APICall,
47 "keep_disk": cli.APICall,
48 "keep_service": cli.APICall,
52 "pipeline_instance": cli.APICall,
53 "pipeline_template": cli.APICall,
54 "repository": cli.APICall,
55 "specimen": cli.APICall,
57 "user_agreement": cli.APICall,
59 "virtual_machine": cli.APICall,
60 "workflow": cli.APICall,
64 type versionCmd struct{}
66 func (versionCmd) RunCommand(prog string, args []string, _ io.Reader, stdout, _ io.Writer) int {
67 prog = regexp.MustCompile(` -*version$`).ReplaceAllLiteralString(prog, "")
68 fmt.Fprintf(stdout, "%s %s (%s)\n", prog, version, runtime.Version())
72 func fixLegacyArgs(args []string) []string {
73 flags, _ := cli.LegacyFlagSet()
74 return cmd.SubcommandToFront(args, flags)
78 os.Exit(handler.RunCommand(os.Args[0], fixLegacyArgs(os.Args[1:]), os.Stdin, os.Stdout, os.Stderr))