Files
trufflehog/pkg/tui/sources/gcs/gcs.go
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
953 B
Go

package gcs
import (
"strings"
"github.com/trufflesecurity/trufflehog/v3/pkg/tui/common"
"github.com/trufflesecurity/trufflehog/v3/pkg/tui/components/textinputs"
)
type gcsCmdModel struct {
textinputs.Model
}
func GetFields() gcsCmdModel {
projectId := textinputs.InputConfig{
Label: "Project ID",
Key: "project-id",
Required: true,
Placeholder: "trufflehog-testing",
}
return gcsCmdModel{textinputs.New([]textinputs.InputConfig{projectId})}
}
func (m gcsCmdModel) Cmd() string {
var command []string
command = append(command, "trufflehog", "gcs")
inputs := m.GetInputs()
command = append(command, "--project-id="+inputs["project-id"].Value)
command = append(command, "--cloud-environment")
return strings.Join(command, " ")
}
func (m gcsCmdModel) Summary() string {
inputs := m.GetInputs()
labels := m.GetLabels()
keys := []string{"project-id"}
return common.SummarizeSource(keys, inputs, labels)
}