Files
trufflehog/pkg/tui/sources/filesystem/filesystem.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

43 lines
944 B
Go

package filesystem
import (
"strings"
"github.com/trufflesecurity/trufflehog/v3/pkg/tui/common"
"github.com/trufflesecurity/trufflehog/v3/pkg/tui/components/textinputs"
)
type fsModel struct {
textinputs.Model
}
func GetFields() fsModel {
path := textinputs.InputConfig{
Label: "Path",
Key: "path",
Required: true,
Help: "Files and directories to scan. Separate by space if multiple.",
Placeholder: "path/to/file.txt path/to/another/dir",
}
return fsModel{textinputs.New([]textinputs.InputConfig{path})}
}
func (m fsModel) Cmd() string {
var command []string
command = append(command, "trufflehog", "filesystem")
inputs := m.GetInputs()
command = append(command, inputs["path"].Value)
return strings.Join(command, " ")
}
func (m fsModel) Summary() string {
inputs := m.GetInputs()
labels := m.GetLabels()
keys := []string{"path"}
return common.SummarizeSource(keys, inputs, labels)
}