github.com/jcarley/cli@v0.0.0-20180201210820-966d90434c30/commands/supportids/contract.go (about)

     1  package supportids
     2  
     3  import (
     4  	"github.com/Sirupsen/logrus"
     5  	"github.com/daticahealth/cli/models"
     6  	"github.com/jault3/mow.cli"
     7  )
     8  
     9  // Cmd is the contract between the user and the CLI. This specifies the command
    10  // name, arguments, and required/optional arguments and flags for the command.
    11  var Cmd = models.Command{
    12  	Name:      "support-ids",
    13  	ShortHelp: "Print out various IDs related to an environment to be used when contacting Datica support",
    14  	LongHelp: "<code>support-ids</code> is helpful when contacting Datica support by submitting a ticket at https://datica.com/support. " +
    15  		"If you are having an issue with a CLI command or anything with your environment, it is helpful to run this command and copy the output into the initial correspondence with a Datica engineer. " +
    16  		"This will help Datica identify the environment faster and help come to resolution faster. Here is a sample command\n\n" +
    17  		"<pre>\ndatica -E \"<your_env_name>\" support-ids\n</pre>",
    18  	CmdFunc: func(settings *models.Settings) func(cmd *cli.Cmd) {
    19  		return func(cmd *cli.Cmd) {
    20  			cmd.Action = func() {
    21  				err := CmdSupportIDs(New(settings))
    22  				if err != nil {
    23  					logrus.Fatal(err.Error())
    24  				}
    25  			}
    26  		}
    27  	},
    28  }
    29  
    30  // ISupportIDs
    31  type ISupportIDs interface {
    32  	SupportIDs() (string, string, string, string, error)
    33  }
    34  
    35  // SSupportIDs is a concrete implementation of ISupportIDs
    36  type SSupportIDs struct {
    37  	Settings *models.Settings
    38  }
    39  
    40  // New returns an instance of ISupportIDs
    41  func New(settings *models.Settings) ISupportIDs {
    42  	return &SSupportIDs{
    43  		Settings: settings,
    44  	}
    45  }