git-lfs/commands/command_env.go
Rick Olson 514d947c8e teach config.Endpoint() to return an Endpoint struct with optional ssh info
$ git lfs env
Endpoint=https://172.28.128.4/ghe-admin/git-lfs-test.git/info/lfs
  SSH=git@172.28.128.4:ghe-admin/git-lfs-test.git
LocalWorkingDir=/Users/rick/github/git-lfs-test
LocalGitDir=/Users/rick/github/git-lfs-test/.git
LocalMediaDir=/Users/rick/github/git-lfs-test/.git/lfs/objects
TempDir=/Users/rick/github/git-lfs-test/.git/lfs/tmp
2015-03-27 16:36:33 -06:00

44 lines
857 B
Go

package commands
import (
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
)
var (
envCmd = &cobra.Command{
Use: "env",
Short: "Show the current environment",
Run: envCommand,
}
)
func envCommand(cmd *cobra.Command, args []string) {
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)
}
}
for _, env := range lfs.Environ() {
Print(env)
}
}
func init() {
RootCmd.AddCommand(envCmd)
}