buildr/internal/cmd/env.go
Peter 1261932bdc
All checks were successful
continuous-integration/drone/push Build is passing
refactor: apply golangci-lint findings
2023-06-22 19:16:00 +02:00

29 lines
545 B
Go

package cmd
import (
"os"
"github.com/spf13/cobra"
)
func EnvCommand(cmder EnvCommander) *cobra.Command {
envCmd := &cobra.Command{
Use: "env",
SilenceUsage: true,
SilenceErrors: true,
}
printPathCmd := &cobra.Command{
Use: "path",
Short: "Helper to configure your shell's $PATH to include local tools",
Example: `export $(buildr env path)`,
RunE: func(cmd *cobra.Command, _ []string) error {
return cmder.PrintPath(cmd.Context(), os.Stdout)
},
}
envCmd.AddCommand(printPathCmd)
return envCmd
}