e9ffd5dc5c
Right now, all of the SSH metadata for an endpoint is in the Endpoint struct, but in the future we'd like to move the SSH code to its own package. At that point, we'll want to avoid a dependency on the Endpoint struct, so let's move the SSH metadata out into its own struct, which we'll include in Endpoint. While we're at it, let's adjust most of the SSH code to use this new struct instead so we can easily move it in the future.
60 lines
1.6 KiB
Go
60 lines
1.6 KiB
Go
package commands
|
|
|
|
import (
|
|
"github.com/git-lfs/git-lfs/config"
|
|
"github.com/git-lfs/git-lfs/git"
|
|
"github.com/git-lfs/git-lfs/lfs"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func envCommand(cmd *cobra.Command, args []string) {
|
|
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.SSHMetadata.UserAndHost) > 0 {
|
|
Print(" SSH=%s:%s", endpoint.SSHMetadata.UserAndHost, endpoint.SSHMetadata.Path)
|
|
}
|
|
}
|
|
}
|
|
|
|
for _, remote := range cfg.Remotes() {
|
|
if remote == defaultRemote {
|
|
continue
|
|
}
|
|
remoteEndpoint := getAPIClient().Endpoints.Endpoint("download", remote)
|
|
remoteAccess := getAPIClient().Endpoints.AccessFor(remoteEndpoint.Url)
|
|
Print("Endpoint (%s)=%s (auth=%s)", remote, remoteEndpoint.Url, remoteAccess.Mode())
|
|
if len(remoteEndpoint.SSHMetadata.UserAndHost) > 0 {
|
|
Print(" SSH=%s:%s", remoteEndpoint.SSHMetadata.UserAndHost, remoteEndpoint.SSHMetadata.Path)
|
|
}
|
|
}
|
|
|
|
for _, env := range lfs.Environ(cfg, getTransferManifest(), oldEnv) {
|
|
Print(env)
|
|
}
|
|
|
|
for _, key := range []string{"filter.lfs.process", "filter.lfs.smudge", "filter.lfs.clean"} {
|
|
value, _ := cfg.Git.Get(key)
|
|
Print("git config %s = %q", key, value)
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
RegisterCommand("env", envCommand, nil)
|
|
}
|