pulumi/cmd/mu.go
joeduffy bf33605195 Rearrange the library code
This rearranges the library code:

* sdk/... goes away.

* What used to be sdk/javascript/ is now lib/mu/, an actual MuPackage
  that provides the base abstractions for all other MuPackages to use.

* lib/aws is the @mu/aws MuPackage that exposes all AWS resources.

* lib/mux is the @mu/x MuPackage that provides cross-cloud abstractions.
  A lot of what used to be in lib/mu goes here.  In particular, autoscaler,
  func, ..., all the "general purpose" abstractions, really.
2017-01-20 10:30:43 -08:00

48 lines
1.3 KiB
Go

// Copyright 2016 Marapongo, Inc. All rights reserved.
package cmd
import (
"flag"
"strconv"
"github.com/golang/glog"
"github.com/spf13/cobra"
)
func NewMuCmd() *cobra.Command {
var logToStderr bool
var verbose int
cmd := &cobra.Command{
Use: "mu",
Short: "Mu is a framework and toolset for reusable stacks of services",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Ensure the glog library has been initialized, including calling flag.Parse beforehand. Unfortunately,
// this is the only way to control the way glog runs. That includes poking around at flags below.
flag.Parse()
if logToStderr {
flag.Lookup("logtostderr").Value.Set("true")
}
if verbose > 0 {
flag.Lookup("v").Value.Set(strconv.Itoa(verbose))
}
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
glog.Flush()
},
}
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(newApplyCmd())
cmd.AddCommand(newCompileCmd())
cmd.AddCommand(newDescribeCmd())
cmd.AddCommand(newGetCmd())
cmd.AddCommand(newPlanCmd())
cmd.AddCommand(newVersionCmd())
return cmd
}