func (c *Cmd) String() string { _, _, cmd, err := shell.ShCommandf(c.Shell, c.Format, c.FormatArgs...) if err != nil { return "error formatting cmd: " + err.Error() } return cmd }
func (c *Cmd) formatCmd() (string, error) { cmdf := c.Format if c.Dir != "" { cmdf = fmt.Sprintf("cd %s && %s", c.Dir, cmdf) } shell, shellargs, cmd, err := shell.ShCommandf(c.Shell, cmdf, c.FormatArgs...) if err != nil { return "", err } return fmt.Sprintf(`%s %s "%s"`, shell, strings.Join(shellargs, " "), cmd), nil }