Update read_text call for Py3.13
[arvados.git] / cmd / arvados-client / cmd.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package main
6
7 import (
8         "os"
9
10         "git.arvados.org/arvados.git/lib/cli"
11         "git.arvados.org/arvados.git/lib/cmd"
12         "git.arvados.org/arvados.git/lib/deduplicationreport"
13         "git.arvados.org/arvados.git/lib/diagnostics"
14         "git.arvados.org/arvados.git/lib/mount"
15 )
16
17 var (
18         handler = cmd.Multi(map[string]cmd.Handler{
19                 "-e":        cmd.Version,
20                 "version":   cmd.Version,
21                 "-version":  cmd.Version,
22                 "--version": cmd.Version,
23
24                 "copy":   cli.Copy,
25                 "create": cli.Create,
26                 "edit":   cli.Edit,
27                 "get":    cli.Get,
28                 "keep":   cli.Keep,
29                 "tag":    cli.Tag,
30                 "ws":     cli.Ws,
31
32                 "api_client_authorization": cli.APICall,
33                 "api_client":               cli.APICall,
34                 "authorized_key":           cli.APICall,
35                 "collection":               cli.APICall,
36                 "container":                cli.APICall,
37                 "container_request":        cli.APICall,
38                 "group":                    cli.APICall,
39                 "keep_service":             cli.APICall,
40                 "link":                     cli.APICall,
41                 "log":                      cli.APICall,
42                 "user_agreement":           cli.APICall,
43                 "user":                     cli.APICall,
44                 "virtual_machine":          cli.APICall,
45                 "workflow":                 cli.APICall,
46
47                 "connect-ssh":          connectSSHCommand{},
48                 "deduplication-report": deduplicationreport.Command,
49                 "diagnostics":          diagnostics.Command{},
50                 "logs":                 logsCommand{},
51                 "mount":                mount.Command,
52                 "shell":                shellCommand{},
53                 "sudo":                 sudoCommand{},
54         })
55 )
56
57 func fixLegacyArgs(args []string) []string {
58         flags, _ := cli.LegacyFlagSet()
59         return cmd.SubcommandToFront(args, flags)
60 }
61
62 func main() {
63         os.Exit(handler.RunCommand(os.Args[0], fixLegacyArgs(os.Args[1:]), os.Stdin, os.Stdout, os.Stderr))
64 }