Skip to content

Commit

Permalink
fix: let loadConfig fills config.outputFile
Browse files Browse the repository at this point in the history
  • Loading branch information
pluveto committed Nov 26, 2023
1 parent ae4c846 commit e981212
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ func loadConfig() Config {
if prefix == "" {
prefix = "/"
}
if config.outputFile == "" {
config.outputFile = strings.TrimSuffix(config.inputFile, filepath.Ext(config.inputFile)) + ".out.md"
}

config.inputFile = inputFile
config.outputFile = outputFile
Expand Down Expand Up @@ -172,10 +175,6 @@ func buildIndex(config Config) error {
}

func processFile(config Config) error {
if config.outputFile == "" {
config.outputFile = strings.TrimSuffix(config.inputFile, filepath.Ext(config.inputFile)) + ".out.md"
}

if !config.force {
if _, err := os.Stat(config.outputFile); err == nil {
return errors.New("output file already exists")
Expand Down

0 comments on commit e981212

Please sign in to comment.