blob: 53daf9ba3b522b621095b763171988cc714f95b8 [file] [log] [blame]
Scott Baker2c0ebda2019-05-06 16:55:47 -07001/*
2 * Portions copyright 2019-present Open Networking Foundation
3 * Original copyright 2019-present Ciena Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package main
18
19import (
20 flags "github.com/jessevdk/go-flags"
21 "github.com/opencord/cordctl/commands"
22 "os"
23 "path"
24)
25
26func main() {
27
28 parser := flags.NewNamedParser(path.Base(os.Args[0]), flags.Default|flags.PassAfterNonOption)
29 _, err := parser.AddGroup("Global Options", "", &commands.GlobalOptions)
30 if err != nil {
31 panic(err)
32 }
Scott Baker6cf525a2019-05-09 12:25:08 -070033 commands.RegisterBackupCommands(parser)
Scott Baker2c0ebda2019-05-06 16:55:47 -070034 commands.RegisterModelCommands(parser)
35 commands.RegisterServiceCommands(parser)
36 commands.RegisterTransferCommands(parser)
37 commands.RegisterVersionCommands(parser)
Scott Baker63ce82e2019-05-15 09:01:42 -070038 commands.RegisterCompletionCommands(parser)
39 commands.RegisterConfigCommands(parser)
Scott Baker2c0ebda2019-05-06 16:55:47 -070040
41 _, err = parser.ParseArgs(os.Args[1:])
42 if err != nil {
43 _, ok := err.(*flags.Error)
44 if ok {
45 real := err.(*flags.Error)
46 if real.Type == flags.ErrHelp {
47 return
48 }
49 } else {
50 panic(err)
51 }
52 os.Exit(1)
53 }
54}