✨ Add separator option
This commit is contained in:
parent
84994d3b73
commit
4b509d31bb
6 changed files with 37 additions and 8 deletions
13
options.go
13
options.go
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue