buildr/internal/cmd/env.go

29 lines
545 B
Go
Raw Normal View History

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)`,
2023-06-22 16:06:56 +00:00
RunE: func(cmd *cobra.Command, _ []string) error {
return cmder.PrintPath(cmd.Context(), os.Stdout)
},
}
envCmd.AddCommand(printPathCmd)
return envCmd
}