Add fake client for local command operation (#1515)
This PR adds a fake controller client for local CLI operations like offline spec generation or for unit test purposes. The fake client now only implements the "Version()" function and more functions will be implemented once we figure out how to achieve the goals mentioned above.
This commit is contained in:
@@ -20,13 +20,18 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
wrapper "github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra"
|
||||
"github.com/fission/fission/pkg/fission-cli/flag"
|
||||
)
|
||||
|
||||
func Commands() *cobra.Command {
|
||||
command := &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Version information",
|
||||
Short: "Show client/server version information",
|
||||
RunE: wrapper.Wrapper(Version),
|
||||
}
|
||||
wrapper.SetFlags(command, flag.FlagSet{
|
||||
Optional: []flag.Flag{flag.ClientOnly},
|
||||
})
|
||||
|
||||
return command
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ var (
|
||||
GlobalVerbosity = Flag{Type: Int, Name: flagkey.Verbosity, Short: "v", Usage: "CLI verbosity (0 is quiet, 1 is the default, 2 is verbose)", DefaultValue: 1}
|
||||
GlobalServer = Flag{Type: String, Name: flagkey.Server, Usage: "Server URL"}
|
||||
|
||||
ClientOnly = Flag{Type: Bool, Name: flagkey.ClientOnly, Usage: "If set, the CLI won't connect to remote server"}
|
||||
|
||||
NamespaceFunction = Flag{Type: String, Name: flagkey.NamespaceFunction, Aliases: []string{"fns"}, Usage: "Namespace for function object", DefaultValue: metav1.NamespaceDefault}
|
||||
NamespaceEnvironment = Flag{Type: String, Name: flagkey.NamespaceEnvironment, Aliases: []string{"envns"}, Usage: "Namespace for environment object", DefaultValue: metav1.NamespaceDefault}
|
||||
NamespacePackage = Flag{Type: String, Name: flagkey.NamespacePackage, Aliases: []string{"pkgns"}, Usage: "Namespace for package object", DefaultValue: metav1.NamespaceDefault}
|
||||
|
||||
@@ -17,8 +17,9 @@ limitations under the License.
|
||||
package flagkey
|
||||
|
||||
const (
|
||||
Verbosity = "verbosity"
|
||||
Server = "server"
|
||||
Verbosity = "verbosity"
|
||||
Server = "server"
|
||||
ClientOnly = "client-only"
|
||||
|
||||
resourceName = "name"
|
||||
force = "force"
|
||||
|
||||
Reference in New Issue
Block a user