2017-05-18 23:51:52 +02:00
|
|
|
// Licensed to Pulumi Corporation ("Pulumi") under one or more
|
|
|
|
// contributor license agreements. See the NOTICE file distributed with
|
|
|
|
// this work for additional information regarding copyright ownership.
|
|
|
|
// Pulumi licenses this file to You under the Apache License, Version 2.0
|
|
|
|
// (the "License"); you may not use this file except in compliance with
|
|
|
|
// the License. You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2017-04-12 20:04:04 +02:00
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/golang/glog"
|
|
|
|
"github.com/spf13/cobra"
|
2017-04-13 14:27:45 +02:00
|
|
|
|
2017-05-18 20:38:28 +02:00
|
|
|
"github.com/pulumi/lumi/pkg/util/cmdutil"
|
2017-04-12 20:04:04 +02:00
|
|
|
)
|
|
|
|
|
2017-05-18 20:38:28 +02:00
|
|
|
func NewLumiCmd() *cobra.Command {
|
2017-05-31 18:14:49 +02:00
|
|
|
var logFlow bool
|
2017-04-12 20:04:04 +02:00
|
|
|
var logToStderr bool
|
|
|
|
var verbose int
|
|
|
|
cmd := &cobra.Command{
|
2017-05-18 20:38:28 +02:00
|
|
|
Use: "lumi",
|
|
|
|
Short: "Lumi is a framework and toolset for reusable stacks of services",
|
2017-04-12 20:04:04 +02:00
|
|
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
2017-05-31 18:14:49 +02:00
|
|
|
cmdutil.InitLogging(logToStderr, verbose, logFlow)
|
2017-04-12 20:04:04 +02:00
|
|
|
},
|
|
|
|
PersistentPostRun: func(cmd *cobra.Command, args []string) {
|
|
|
|
glog.Flush()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2017-05-31 18:14:49 +02:00
|
|
|
cmd.PersistentFlags().BoolVar(&logFlow, "logflow", false, "Flow log settings to child processes (like plugins)")
|
2017-04-12 20:04:04 +02:00
|
|
|
cmd.PersistentFlags().BoolVar(&logToStderr, "logtostderr", false, "Log to stderr instead of to files")
|
|
|
|
cmd.PersistentFlags().IntVarP(
|
|
|
|
&verbose, "verbose", "v", 0, "Enable verbose logging (e.g., v=3); anything >3 is very verbose")
|
|
|
|
|
|
|
|
cmd.AddCommand(newConfigCmd())
|
|
|
|
cmd.AddCommand(newDeployCmd())
|
|
|
|
cmd.AddCommand(newDestroyCmd())
|
|
|
|
cmd.AddCommand(newEnvCmd())
|
|
|
|
cmd.AddCommand(newPackCmd())
|
|
|
|
cmd.AddCommand(newPlanCmd())
|
|
|
|
cmd.AddCommand(newVersionCmd())
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
}
|