This commit introduces the `borg collect archive` command, allowing users to collect items from the Internet Archive. The command includes three subcommands: - `search [query]`: Searches for items and collects them. - `item [identifier]`: Collects a specific item. - `collection [identifier]`: Collects all items in a collection. A new package, `pkg/archive`, has been created to handle all API interactions with archive.org. The implementation includes pagination to ensure all items are retrieved from large searches or collections. Downloaded items are stored in an `archive/` directory, with each item's files and metadata saved in a subdirectory named after its identifier. Unit and integration tests have been added to verify the functionality of the new commands and the API client. All existing tests continue to pass. Co-authored-by: Snider <631881+Snider@users.noreply.github.com>
16 lines
395 B
Go
16 lines
395 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// collectArchiveCmd represents the collect archive command
|
|
var collectArchiveCmd = &cobra.Command{
|
|
Use: "archive",
|
|
Short: "Collect a resource from the Internet Archive.",
|
|
Long: `Collect a resource from the Internet Archive, such as a search query, an item, or a collection.`,
|
|
}
|
|
|
|
func init() {
|
|
collectCmd.AddCommand(collectArchiveCmd)
|
|
}
|