refactor
This commit is contained in:
parent
aedc4a4518
commit
9b0e2ed6dc
15 changed files with 693 additions and 540 deletions
21
internal/formatter/formatter.go
Normal file
21
internal/formatter/formatter.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package formatter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"sub-cli/internal/format/lrc"
|
||||
)
|
||||
|
||||
// Format formats a subtitle file to ensure consistent formatting
|
||||
func Format(filePath string) error {
|
||||
ext := strings.TrimPrefix(filepath.Ext(filePath), ".")
|
||||
|
||||
switch ext {
|
||||
case "lrc":
|
||||
return lrc.Format(filePath)
|
||||
default:
|
||||
return fmt.Errorf("unsupported format for formatting: %s", ext)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue