github.com/q2/git-lfs@v0.5.1-0.20150410234700-03a0d4cec40e/commands/command_env.go (about)

     1  package commands
     2  
     3  import (
     4  	"github.com/github/git-lfs/lfs"
     5  	"github.com/spf13/cobra"
     6  )
     7  
     8  var (
     9  	envCmd = &cobra.Command{
    10  		Use:   "env",
    11  		Short: "Show the current environment",
    12  		Run:   envCommand,
    13  	}
    14  )
    15  
    16  func envCommand(cmd *cobra.Command, args []string) {
    17  	config := lfs.Config
    18  
    19  	endpoint := config.Endpoint()
    20  
    21  	if len(endpoint.Url) > 0 {
    22  		Print("Endpoint=%s", endpoint.Url)
    23  		if len(endpoint.SshUserAndHost) > 0 {
    24  			Print("  SSH=%s:%s", endpoint.SshUserAndHost, endpoint.SshPath)
    25  		}
    26  	}
    27  
    28  	for _, remote := range config.Remotes() {
    29  		remoteEndpoint := config.RemoteEndpoint(remote)
    30  		Print("Endpoint (%s)=%s", remote, remoteEndpoint.Url)
    31  		if len(endpoint.SshUserAndHost) > 0 {
    32  			Print("  SSH=%s:%s", endpoint.SshUserAndHost, endpoint.SshPath)
    33  		}
    34  	}
    35  
    36  	for _, env := range lfs.Environ() {
    37  		Print(env)
    38  	}
    39  }
    40  
    41  func init() {
    42  	RootCmd.AddCommand(envCmd)
    43  }