mirror of
https://github.com/openziti/ziti.git
synced 2026-10-13 15:51:21 +00:00
don't configure root command with PersistentPostRun, because it doesn't apply for all subcommands. (#77)
do configure run subcommand with PostRun.
This commit is contained in:
@@ -45,10 +45,9 @@ func init() {
|
||||
}
|
||||
|
||||
var root = &cobra.Command{
|
||||
Use: filepath.Base(os.Args[0]),
|
||||
Short: "Ziti Tunnel",
|
||||
PersistentPreRun: rootPreRun,
|
||||
PersistentPostRun: rootPostRun,
|
||||
Use: filepath.Base(os.Args[0]),
|
||||
Short: "Ziti Tunnel",
|
||||
PersistentPreRun: rootPreRun,
|
||||
}
|
||||
|
||||
var interceptor intercept.Interceptor
|
||||
|
||||
@@ -19,19 +19,20 @@
|
||||
package subcmd
|
||||
|
||||
import (
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/netfoundry/ziti-edge/tunnel/intercept"
|
||||
"github.com/netfoundry/ziti-edge/tunnel/intercept/tproxy"
|
||||
"github.com/netfoundry/ziti-edge/tunnel/intercept/tun"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var runCmd = &cobra.Command{
|
||||
Use: "run <config>",
|
||||
Short: "Auto-select interceptor",
|
||||
Long: "Provided for backwards compatibility with scripts that were coded around older ziti-tunnel versions.",
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Run: run,
|
||||
Use: "run <config>",
|
||||
Short: "Auto-select interceptor",
|
||||
Long: "Provided for backwards compatibility with scripts that were coded around older ziti-tunnel versions.",
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Run: run,
|
||||
PostRun: rootPostRun,
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -68,4 +69,4 @@ func run(cmd *cobra.Command, args []string) {
|
||||
if interceptor == nil {
|
||||
log.Fatal("failed to initialize an interceptor")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user