2014-06-03 15:08:58 +00:00
|
|
|
package commands
|
2013-11-05 17:52:31 +00:00
|
|
|
|
|
|
|
import (
|
2015-06-17 17:08:22 +00:00
|
|
|
"github.com/github/git-lfs/git"
|
2015-03-19 19:30:55 +00:00
|
|
|
"github.com/github/git-lfs/lfs"
|
2015-05-25 18:20:50 +00:00
|
|
|
"github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra"
|
2013-11-05 17:52:31 +00:00
|
|
|
)
|
|
|
|
|
2014-06-26 20:09:14 +00:00
|
|
|
var (
|
|
|
|
envCmd = &cobra.Command{
|
2015-09-17 22:08:28 +00:00
|
|
|
Use: "env",
|
|
|
|
Run: envCommand,
|
2014-06-26 20:09:14 +00:00
|
|
|
}
|
|
|
|
)
|
2013-11-05 17:52:31 +00:00
|
|
|
|
2014-06-26 20:09:14 +00:00
|
|
|
func envCommand(cmd *cobra.Command, args []string) {
|
2015-11-16 20:13:47 +00:00
|
|
|
lfs.ShowConfigWarnings = true
|
2015-03-19 19:30:55 +00:00
|
|
|
config := lfs.Config
|
2015-03-27 22:36:33 +00:00
|
|
|
endpoint := config.Endpoint()
|
|
|
|
|
2015-06-17 17:08:22 +00:00
|
|
|
gitV, err := git.Config.Version()
|
|
|
|
if err != nil {
|
|
|
|
gitV = "Error getting git version: " + err.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
Print(lfs.UserAgent)
|
|
|
|
Print(gitV)
|
|
|
|
Print("")
|
|
|
|
|
2015-03-27 22:36:33 +00:00
|
|
|
if len(endpoint.Url) > 0 {
|
2015-09-01 21:47:47 +00:00
|
|
|
Print("Endpoint=%s (auth=%s)", endpoint.Url, config.Access())
|
2015-03-27 22:36:33 +00:00
|
|
|
if len(endpoint.SshUserAndHost) > 0 {
|
|
|
|
Print(" SSH=%s:%s", endpoint.SshUserAndHost, endpoint.SshPath)
|
|
|
|
}
|
2014-02-01 20:46:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for _, remote := range config.Remotes() {
|
2015-03-27 22:36:33 +00:00
|
|
|
remoteEndpoint := config.RemoteEndpoint(remote)
|
2015-09-01 21:47:47 +00:00
|
|
|
Print("Endpoint (%s)=%s (auth=%s)", remote, remoteEndpoint.Url, config.EndpointAccess(remoteEndpoint))
|
2015-11-11 12:46:56 +00:00
|
|
|
if len(remoteEndpoint.SshUserAndHost) > 0 {
|
|
|
|
Print(" SSH=%s:%s", remoteEndpoint.SshUserAndHost, remoteEndpoint.SshPath)
|
2015-03-27 22:36:33 +00:00
|
|
|
}
|
2014-02-01 20:38:29 +00:00
|
|
|
}
|
|
|
|
|
2015-03-19 19:30:55 +00:00
|
|
|
for _, env := range lfs.Environ() {
|
2014-06-05 18:19:30 +00:00
|
|
|
Print(env)
|
2014-01-24 01:30:48 +00:00
|
|
|
}
|
2015-09-23 20:02:22 +00:00
|
|
|
|
|
|
|
for _, key := range []string{"filter.lfs.smudge", "filter.lfs.clean"} {
|
|
|
|
value, _ := lfs.Config.GitConfig(key)
|
|
|
|
Print("git config %s = %q", key, value)
|
|
|
|
}
|
2013-11-05 17:52:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2014-06-26 20:09:14 +00:00
|
|
|
RootCmd.AddCommand(envCmd)
|
2013-11-05 17:52:31 +00:00
|
|
|
}
|