You've already forked step-ca-cli
mirror of
https://github.com/smallstep/cli.git
synced 2025-08-09 03:22:43 +03:00
@@ -16,12 +16,11 @@ import (
|
|||||||
"github.com/smallstep/cli/usage"
|
"github.com/smallstep/cli/usage"
|
||||||
|
|
||||||
// Enabled commands
|
// Enabled commands
|
||||||
|
_ "github.com/smallstep/cli/command/ca"
|
||||||
_ "github.com/smallstep/cli/command/certificate"
|
_ "github.com/smallstep/cli/command/certificate"
|
||||||
_ "github.com/smallstep/cli/command/crypto"
|
_ "github.com/smallstep/cli/command/crypto"
|
||||||
_ "github.com/smallstep/cli/command/oauth"
|
_ "github.com/smallstep/cli/command/oauth"
|
||||||
|
_ "github.com/smallstep/cli/command/path"
|
||||||
// Work in progress ...
|
|
||||||
_ "github.com/smallstep/cli/command/ca"
|
|
||||||
|
|
||||||
// Profiling and debugging
|
// Profiling and debugging
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
@@ -68,25 +67,10 @@ func main() {
|
|||||||
Usage: "path to the config file to use for CLI flags",
|
Usage: "path to the config file to use for CLI flags",
|
||||||
})
|
})
|
||||||
|
|
||||||
// Flag for printing the step path
|
|
||||||
app.Flags = append(app.Flags, cli.BoolFlag{
|
|
||||||
Name: "steppath",
|
|
||||||
Usage: "print the configured step path and exit",
|
|
||||||
})
|
|
||||||
|
|
||||||
// All non-successful output should be written to stderr
|
// All non-successful output should be written to stderr
|
||||||
app.Writer = os.Stdout
|
app.Writer = os.Stdout
|
||||||
app.ErrWriter = os.Stderr
|
app.ErrWriter = os.Stderr
|
||||||
|
|
||||||
// Default action will print the steppath or help
|
|
||||||
app.Action = cli.ActionFunc(func(ctx *cli.Context) error {
|
|
||||||
if ctx.Bool("steppath") {
|
|
||||||
fmt.Println(config.StepPath())
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return cli.HandleAction(usage.HelpCommandAction, ctx)
|
|
||||||
})
|
|
||||||
|
|
||||||
// Start the golang debug logger if environment variable is set.
|
// Start the golang debug logger if environment variable is set.
|
||||||
// See https://golang.org/pkg/net/http/pprof/
|
// See https://golang.org/pkg/net/http/pprof/
|
||||||
debugProfAddr := os.Getenv("STEP_PROF_ADDR")
|
debugProfAddr := os.Getenv("STEP_PROF_ADDR")
|
||||||
|
24
command/path/path.go
Normal file
24
command/path/path.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package path
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/smallstep/cli/command"
|
||||||
|
"github.com/smallstep/cli/config"
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
cmd := cli.Command{
|
||||||
|
Name: "path",
|
||||||
|
Usage: "print the configured step path and exit",
|
||||||
|
UsageText: "step path",
|
||||||
|
Description: "**step ca** command prints the configured step path and exit",
|
||||||
|
Action: cli.ActionFunc(func(ctx *cli.Context) error {
|
||||||
|
fmt.Println(config.StepPath())
|
||||||
|
return nil
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
command.Register(cmd)
|
||||||
|
}
|
Reference in New Issue
Block a user