blob: 19a27c72d4447b0e9fbb6f747d7e70ba68299f6e [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)
Scott Baker5281d002019-05-16 10:45:26 -070035 commands.RegisterModelTypeCommands(parser)
Scott Baker2c0ebda2019-05-06 16:55:47 -070036 commands.RegisterServiceCommands(parser)
37 commands.RegisterTransferCommands(parser)
38 commands.RegisterVersionCommands(parser)
Scott Baker63ce82e2019-05-15 09:01:42 -070039 commands.RegisterCompletionCommands(parser)
40 commands.RegisterConfigCommands(parser)
Scott Bakerd8476822019-06-07 15:12:09 -070041 commands.RegisterStatusCommands(parser)
Scott Baker2c0ebda2019-05-06 16:55:47 -070042
43 _, err = parser.ParseArgs(os.Args[1:])
44 if err != nil {
45 _, ok := err.(*flags.Error)
46 if ok {
47 real := err.(*flags.Error)
48 if real.Type == flags.ErrHelp {
49 return
50 }
51 } else {
52 panic(err)
53 }
54 os.Exit(1)
55 }
56}