Files
Hon Kwokandmcastorina 4598244167 Use placeholder as default if field left empty and is required (#1642)
* Use placeholder as default if field left empty and is required

Co-authored-by: mcastorina <[email protected]>

* Drop unused func

* uncomment azure source

* update wording

---------

Co-authored-by: mcastorina <[email protected]>
2023-10-02 17:21:40 -07:00

44 lines
924 B
Go

package git
import (
"strings"
"github.com/trufflesecurity/trufflehog/v3/pkg/tui/common"
"github.com/trufflesecurity/trufflehog/v3/pkg/tui/components/textinputs"
)
type gitCmdModel struct {
textinputs.Model
}
func GetFields() gitCmdModel {
uri := textinputs.InputConfig{
Label: "Git URI",
Key: "uri",
Help: "file:// for local git repos",
Required: true,
Placeholder: "[email protected]:trufflesecurity/trufflehog.git",
}
return gitCmdModel{textinputs.New([]textinputs.InputConfig{uri})}
}
func (m gitCmdModel) Cmd() string {
var command []string
command = append(command, "trufflehog", "git")
inputs := m.GetInputs()
command = append(command, inputs["uri"].Value)
return strings.Join(command, " ")
}
func (m gitCmdModel) Summary() string {
inputs := m.GetInputs()
labels := m.GetLabels()
keys := []string{"uri"}
return common.SummarizeSource(keys, inputs, labels)
}