-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v 0.3.0, improved structure, minified main.go, moved logic to process.go
- Loading branch information
1 parent
de5fade
commit 6cb353c
Showing
4 changed files
with
44 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
## PDFminion version history | ||
|
||
0.2.3 add --force flag to allow existing target directory | ||
0.3.0 better structure, minimal main package, moved logic to process.go | ||
0.2.5 fixed nasty bug in numbering | ||
0.2.3 add --force flag to allow existing target directory | ||
0.2.2 | ||
0.2.1 add more command line flags, -h, -s | ||
0.2.0 re-structured packages, add command line flags -t | ||
0.1.0 minimal viable product, make it work. | ||
0.2.1 add more command line flags, -h, -s | ||
0.2.0 re-structured packages, add command line flags -t | ||
0.1.0 minimal viable product, make it work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package pdf | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"pdfminion/internal/config" | ||
"sort" | ||
) | ||
|
||
func ProcessPDFs(cfg *config.Config) error { | ||
InitializePDFInternals() | ||
|
||
files, err := CollectCandidatePDFs(cfg) | ||
if err != nil { | ||
return fmt.Errorf("error collecting candidate PDFs: %w", err) | ||
} | ||
|
||
sort.Slice(files, func(i, j int) bool { | ||
return files[i] < files[j] | ||
}) | ||
|
||
pdfFiles, nrOfValidPDFs := ValidatePDFs(files) | ||
|
||
err = CopyValidatedPDFs(pdfFiles, cfg.SourceDir, cfg.TargetDir, cfg.Force) | ||
if err != nil { | ||
return fmt.Errorf("error during copy: %w", err) | ||
} | ||
|
||
log.Printf("%v", pdfFiles) | ||
|
||
Evenify(nrOfValidPDFs, pdfFiles) | ||
AddPageNumbersToAllFiles(nrOfValidPDFs, pdfFiles) | ||
|
||
return nil | ||
} |