* 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]>
44 lines
924 B
Go
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)
|
|
}
|