Skip to content

Commit 18989bc

Browse files
committed
Add option to use custom zfill
1 parent d940a63 commit 18989bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ris.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Options struct {
1919
Index int `usage:"Start at provided index" default:"1"`
2020
Version bool `usage:"Print installed version"`
2121
KeepName bool `usage:"Keep original filename"`
22+
Zfill int `usage:"Specify preferred zfill" default:"4"`
2223
}
2324

2425
var (
@@ -52,7 +53,7 @@ func main() {
5253

5354
for position, file := range files {
5455
basename := strings.TrimSuffix(file, filepath.Ext(file))
55-
sequence := fmt.Sprintf("%04d", position + opts.Index)
56+
sequence := fmt.Sprintf("%0*d", opts.Zfill, position + opts.Index)
5657

5758
newname := fmt.Sprintf("%s%s", sequence, filepath.Ext(file))
5859
if opts.KeepName {

0 commit comments

Comments
 (0)