blob: 81875a58c5ae6740b036c3c1d594c3d9dbd0156f [file] [log] [blame]
Scott Baker63ce82e2019-05-15 09:01:42 -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 commands
18
19import (
20 "fmt"
21 flags "github.com/jessevdk/go-flags"
22 "gopkg.in/yaml.v2"
23)
24
25const copyrightNotice = `
26# Portions copyright 2019-present Open Networking Foundation
27# Original copyright 2019-present Ciena Corporation
28#
29# Licensed under the Apache License, Version 2.0 (the "License");
30# you may not use this file except in compliance with the License.
31# You may obtain a copy of the License at
32#
33# http://www.apache.org/licenses/LICENSE-2.0
34#
35# Unless required by applicable law or agreed to in writing, software
36# distributed under the License is distributed on an "AS IS" BASIS,
37# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38# See the License for the specific language governing permissions and
39# limitations under the License.
40#
41`
42
43type ConfigOptions struct {
44}
45
46func RegisterConfigCommands(parent *flags.Parser) {
47 parent.AddCommand("config", "generate cordctl configuration", "Commands to generate cordctl configuration", &ConfigOptions{})
48}
49
50func (options *ConfigOptions) Execute(args []string) error {
51 //GlobalConfig
52 ProcessGlobalOptions()
53 b, err := yaml.Marshal(GlobalConfig)
54 if err != nil {
55 return err
56 }
57 fmt.Println(copyrightNotice)
58 fmt.Println(string(b))
59 return nil
60}