Add separator option

This commit is contained in:
Dan Jones 2025-03-11 16:42:39 -05:00
commit 4b509d31bb
6 changed files with 37 additions and 8 deletions

View file

@ -9,21 +9,21 @@ type Option func(c *Config)
// This will be included in the generated name after the generated string and before the suffix.
func WithOriginal(o string) Option {
return func(c *Config) {
c.original = "_" + o
c.original = o
}
}
// WithPrefix sets a prefix for the generated name.
func WithPrefix(p string) Option {
return func(c *Config) {
c.prefix = p + "_"
c.prefix = p
}
}
// WithSuffix sets a suffix for the generated name. It will be included in the base name before the suffix.
func WithSuffix(s string) Option {
return func(c *Config) {
c.suffix = "_" + s
c.suffix = s
}
}
@ -40,3 +40,10 @@ func WithExtension(ext string) Option {
c.extension = "." + strings.TrimPrefix(ext, ".")
}
}
// WithSeparator sets the separator for the generated filename.
func WithSeparator(sep string) Option {
return func(c *Config) {
c.separator = sep
}
}