This change skips printing output<T> properties as we perform a deployment, instead showing the real values inline after the resource has been created. (output<T> is still shown during planning, of course.)
95 lines
3.8 KiB
Go
95 lines
3.8 KiB
Go
// 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.
|
|
|
|
package main
|
|
|
|
import (
|
|
"github.com/golang/glog"
|
|
"github.com/pkg/errors"
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/pulumi/lumi/pkg/tokens"
|
|
"github.com/pulumi/lumi/pkg/tools/lumidl"
|
|
"github.com/pulumi/lumi/pkg/util/cmdutil"
|
|
)
|
|
|
|
func NewIDLCCmd() *cobra.Command {
|
|
var logToStderr bool
|
|
var outPack string
|
|
var outRPC string
|
|
var pkgBaseIDL string
|
|
var pkgBaseRPC string
|
|
var quiet bool
|
|
var recursive bool
|
|
var verbose int
|
|
cmd := &cobra.Command{
|
|
Use: "lumidl pkg-name idl-path",
|
|
Short: "The Lumi IDL compiler generates Lumi metadata and RPC stubs from IDL written in Go",
|
|
Long: "The Lumi IDL compiler generates Lumi metadata and RPC stubs from IDL written in Go.\n" +
|
|
"\n" +
|
|
"The tool accepts a subset of Go types and produces packages that can be consumed by\n" +
|
|
"ordinary Lumi programs and libraries in any language. The pkg-name argument\n" +
|
|
"controls the output package name and idl-path is the path to the IDL source code.\n" +
|
|
"\n" +
|
|
"The --out-pack and --out-rpc flags indicate where generated code is to be saved,\n" +
|
|
"and pkg-base-idl and --pkg-base-rpc may be used to override the default inferred Go\n" +
|
|
"package names (which, by default, are based on your GOPATH).",
|
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
|
cmdutil.InitLogging(logToStderr, verbose, true)
|
|
},
|
|
Run: cmdutil.RunFunc(func(cmd *cobra.Command, args []string) error {
|
|
if len(args) == 0 {
|
|
return cmd.Usage()
|
|
} else if len(args) == 1 {
|
|
return errors.New("missing required [idl-path] argument")
|
|
}
|
|
|
|
// Now pass the arguments and compile the package.
|
|
name := args[0] // the name of the Lumi package.
|
|
path := args[1] // the path to the IDL directory that is compiled recursively.
|
|
return lumidl.Compile(lumidl.CompileOptions{
|
|
Name: tokens.PackageName(name),
|
|
PkgBaseIDL: pkgBaseIDL,
|
|
PkgBaseRPC: pkgBaseRPC,
|
|
OutPack: outPack,
|
|
OutRPC: outRPC,
|
|
Quiet: quiet,
|
|
Recursive: recursive,
|
|
}, path)
|
|
}),
|
|
PersistentPostRun: func(cmd *cobra.Command, args []string) {
|
|
glog.Flush()
|
|
},
|
|
}
|
|
|
|
cmd.PersistentFlags().BoolVar(
|
|
&logToStderr, "logtostderr", false, "Log to stderr instead of to files")
|
|
cmd.PersistentFlags().BoolVarP(
|
|
&recursive, "recursive", "r", false, "Recursively generate code for all sub-packages in the target")
|
|
cmd.PersistentFlags().StringVar(
|
|
&outPack, "out-pack", "", "Save generated package metadata to this directory")
|
|
cmd.PersistentFlags().StringVar(
|
|
&outRPC, "out-rpc", "", "Save generated RPC provider stubs to this directory")
|
|
cmd.PersistentFlags().StringVar(
|
|
&pkgBaseIDL, "pkg-base-idl", "", "Override the base URL where the IDL package is published")
|
|
cmd.PersistentFlags().StringVar(
|
|
&pkgBaseRPC, "pkg-base-rpc", "", "Override the base URL where the RPC package is published")
|
|
cmd.PersistentFlags().BoolVarP(
|
|
&quiet, "quiet", "q", false, "Suppress non-error output progress messages")
|
|
cmd.PersistentFlags().IntVarP(
|
|
&verbose, "verbose", "v", 0, "Enable verbose logging (e.g., v=3); anything >3 is very verbose")
|
|
|
|
return cmd
|
|
}
|