This commit introduces a new feature to extract and index metadata from collected PDF files. The following changes have been made: - Added a new `pdf` command with a `metadata` subcommand to extract metadata from a single PDF file. - Added a new `extract-metadata` command to extract metadata from all PDF files within a given archive and create an `INDEX.json` file. - Added a `--extract-pdf-metadata` flag to the `collect website` command to extract metadata from downloaded PDF files. - Created a new `pdf` package to encapsulate the PDF metadata extraction logic, which uses the `pdfinfo` command from the `poppler-utils` package. - Added unit tests for the new `pdf` package, including mocking the `pdfinfo` command. - Modified `Taskfile.yml` to install `poppler-utils` as a dependency. Co-authored-by: Snider <631881+Snider@users.noreply.github.com>
24 lines
392 B
Go
24 lines
392 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// pdfCmd represents the pdf command
|
|
var pdfCmd = NewPdfCmd()
|
|
|
|
func init() {
|
|
RootCmd.AddCommand(GetPdfCmd())
|
|
}
|
|
|
|
func NewPdfCmd() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "pdf",
|
|
Short: "Perform PDF operations.",
|
|
Long: `A command for performing various PDF operations.`,
|
|
}
|
|
}
|
|
|
|
func GetPdfCmd() *cobra.Command {
|
|
return pdfCmd
|
|
}
|