git-lfs/commands/command_env.go

44 lines
857 B
Go
Raw Normal View History

package commands
import (
2015-03-19 19:30:55 +00:00
"github.com/github/git-lfs/lfs"
2014-06-26 20:09:14 +00:00
"github.com/spf13/cobra"
)
2014-06-26 20:09:14 +00:00
var (
envCmd = &cobra.Command{
Use: "env",
2014-06-26 21:22:24 +00:00
Short: "Show the current environment",
2014-06-26 20:09:14 +00:00
Run: envCommand,
}
)
2014-06-26 20:09:14 +00:00
func envCommand(cmd *cobra.Command, args []string) {
2015-03-19 19:30:55 +00:00
config := lfs.Config
endpoint := config.Endpoint()
if len(endpoint.Url) > 0 {
Print("Endpoint=%s", endpoint.Url)
if len(endpoint.SshUserAndHost) > 0 {
Print(" SSH=%s:%s", endpoint.SshUserAndHost, endpoint.SshPath)
}
}
for _, remote := range config.Remotes() {
remoteEndpoint := config.RemoteEndpoint(remote)
Print("Endpoint (%s)=%s", remote, remoteEndpoint.Url)
if len(endpoint.SshUserAndHost) > 0 {
Print(" SSH=%s:%s", endpoint.SshUserAndHost, endpoint.SshPath)
}
}
2015-03-19 19:30:55 +00:00
for _, env := range lfs.Environ() {
Print(env)
}
}
func init() {
2014-06-26 20:09:14 +00:00
RootCmd.AddCommand(envCmd)
}