29 lines
545 B
Go
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
|
|
}
|