git-lfs/commands/command_env.go

56 lines
1.3 KiB
Go
Raw Normal View History

package commands
import (
"github.com/github/git-lfs/config"
"github.com/github/git-lfs/git"
2015-03-19 19:30:55 +00:00
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
)
2014-06-26 20:09:14 +00:00
func envCommand(cmd *cobra.Command, args []string) {
2016-05-13 16:43:04 +00:00
config.ShowConfigWarnings = true
2016-07-21 22:37:53 +00:00
endpoint := cfg.Endpoint("download")
gitV, err := git.Config.Version()
if err != nil {
gitV = "Error getting git version: " + err.Error()
}
Print(config.VersionDesc)
Print(gitV)
Print("")
if len(endpoint.Url) > 0 {
2016-07-21 22:37:53 +00:00
Print("Endpoint=%s (auth=%s)", endpoint.Url, cfg.EndpointAccess(endpoint))
if len(endpoint.SshUserAndHost) > 0 {
Print(" SSH=%s:%s", endpoint.SshUserAndHost, endpoint.SshPath)
}
}
2016-07-21 22:37:53 +00:00
for _, remote := range cfg.Remotes() {
remoteEndpoint := cfg.RemoteEndpoint(remote, "download")
Print("Endpoint (%s)=%s (auth=%s)", remote, remoteEndpoint.Url, cfg.EndpointAccess(remoteEndpoint))
if len(remoteEndpoint.SshUserAndHost) > 0 {
Print(" SSH=%s:%s", remoteEndpoint.SshUserAndHost, remoteEndpoint.SshPath)
}
}
for _, env := range lfs.Environ(cfg, transfermanifest) {
Print(env)
}
for _, key := range []string{"filter.lfs.smudge", "filter.lfs.clean"} {
2016-07-21 22:37:53 +00:00
value, _ := cfg.GitConfig(key)
Print("git config %s = %q", key, value)
}
}
func init() {
RegisterSubcommand(func() *cobra.Command {
return &cobra.Command{
Use: "env",
Run: envCommand,
}
})
}