blob: d7e4409617aabe8c0cc49df4917b24e4cf5a1f5c [file] [log] [blame]
Zack Williamse940c7a2019-08-21 14:25:39 -07001/*
2 * Copyright 2019-present Ciena Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package commands
17
18import (
19 "fmt"
20 flags "github.com/jessevdk/go-flags"
21 "gopkg.in/yaml.v2"
22)
23
24const copyrightNotice = `
25# Copyright 2019-present Ciena Corporation
26#
27# Licensed under the Apache License, Version 2.0 (the "License");
28# you may not use this file except in compliance with the License.
29# You may obtain a copy of the License at
30#
31# http://www.apache.org/licenses/LICENSE-2.0
32#
33# Unless required by applicable law or agreed to in writing, software
34# distributed under the License is distributed on an "AS IS" BASIS,
35# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36# See the License for the specific language governing permissions and
37# limitations under the License.
38#
39`
40
41type ConfigOptions struct {
42}
43
44func RegisterConfigCommands(parent *flags.Parser) {
45 parent.AddCommand("config", "generate voltctl configuration", "Commands to generate voltctl configuration", &ConfigOptions{})
46}
47
48func (options *ConfigOptions) Execute(args []string) error {
49 //GlobalConfig
50 ProcessGlobalOptions()
51 b, err := yaml.Marshal(GlobalConfig)
52 if err != nil {
53 return err
54 }
55 fmt.Println(copyrightNotice)
56 fmt.Println(string(b))
57 return nil
58}