feat: rename config to cli

This commit is contained in:
2026-02-07 00:15:47 -05:00
parent 8b4b36aa9c
commit 744a2ffd3e
3 changed files with 10 additions and 10 deletions

41
internal/cli/source.go Normal file
View File

@@ -0,0 +1,41 @@
package cli
import (
"io"
"os"
)
// A method of extracting input from the user.
type Source interface {
// Fetch data from this source.
Extract() (string, error)
}
// A source defined by a string.
type StringSource struct{ Data string }
func (s StringSource) Extract() (string, error) { return s.Data, nil }
// A source pulling from standard input.
type StdinSource struct{}
func (s StdinSource) Extract() (string, error) {
data, err := io.ReadAll(os.Stdin)
if err != nil {
return "", err
}
return string(data), nil
}
// A source reading from a file.
type FileSource struct{ Path string }
func (s FileSource) Extract() (string, error) {
data, err := os.ReadFile(s.Path)
if err != nil {
return "", err
}
return string(data), nil
}