feat: statistics flag, commented some more

This commit is contained in:
2025-12-29 20:00:29 -05:00
parent 3f9f3a603f
commit 351faa7e08
8 changed files with 64 additions and 49 deletions

View File

@@ -5,21 +5,21 @@ import (
"os"
)
// Defines the consumption of different types of input sources.
// A method of extracting input from the user.
type Source interface {
// Get the data.
Pull() (string, error)
// Fetch data from this source.
Extract() (string, error)
}
// A source coming from a string.
type StringSource struct{ data string }
// A source defined by a string.
type StringSource struct{ Data string }
func (s StringSource) Pull() (string, error) { return s.data, nil }
func (s StringSource) Extract() (string, error) { return s.Data, nil }
// A source coming from standard input.
// A source pulling from standard input.
type StdinSource struct{}
func (s StdinSource) Pull() (string, error) {
func (s StdinSource) Extract() (string, error) {
data, err := io.ReadAll(os.Stdin)
if err != nil {
return "", err