git-lfs/commands/command_env.go

60 lines
1.6 KiB
Go
Raw Normal View History

package commands
import (
2016-11-15 17:01:18 +00:00
"github.com/git-lfs/git-lfs/config"
"github.com/git-lfs/git-lfs/git"
2016-11-15 17:01:18 +00:00
"github.com/git-lfs/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
gitV, err := git.Version()
if err != nil {
gitV = "Error getting git version: " + err.Error()
}
Print(config.VersionDesc)
Print(gitV)
Print("")
defaultRemote := ""
if cfg.IsDefaultRemote() {
defaultRemote = cfg.Remote()
endpoint := getAPIClient().Endpoints.Endpoint("download", defaultRemote)
if len(endpoint.Url) > 0 {
access := getAPIClient().Endpoints.AccessFor(endpoint.Url)
Print("Endpoint=%s (auth=%s)", endpoint.Url, access.Mode())
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() {
if remote == defaultRemote {
continue
}
remoteEndpoint := getAPIClient().Endpoints.RemoteEndpoint("download", remote)
remoteAccess := getAPIClient().Endpoints.AccessFor(remoteEndpoint.Url)
Print("Endpoint (%s)=%s (auth=%s)", remote, remoteEndpoint.Url, remoteAccess.Mode())
if len(remoteEndpoint.SshUserAndHost) > 0 {
Print(" SSH=%s:%s", remoteEndpoint.SshUserAndHost, remoteEndpoint.SshPath)
}
}
for _, env := range lfs.Environ(cfg, getTransferManifest()) {
Print(env)
}
2016-10-24 06:13:49 +00:00
for _, key := range []string{"filter.lfs.process", "filter.lfs.smudge", "filter.lfs.clean"} {
2016-08-15 21:43:38 +00:00
value, _ := cfg.Git.Get(key)
Print("git config %s = %q", key, value)
}
}
func init() {
RegisterCommand("env", envCommand, nil)
}