diff --git a/go-repo-export/README.md b/go-repo-export/README.md index cb9f279..3433579 100644 --- a/go-repo-export/README.md +++ b/go-repo-export/README.md @@ -31,7 +31,7 @@ go build ./... Commands which talk to the target account's PDS instance: ```shell -go-export-repo download +go-export-repo download-repo go-export-repo list-blobs go-export-repo download-blobs ``` @@ -40,13 +40,13 @@ Which work with a local repo CAR file: ```shell go-export-repo list-records -go-export-repo unpack +go-export-repo unpack-records ``` For example: ```shell -> ./go-export-repo download atproto.com +> ./go-export-repo download-repo atproto.com resolving identity: atproto.com downloading from https://bsky.social to: did:plc:ewvi7nxzyoun6zhxrhs64oiz.car @@ -59,7 +59,7 @@ app.bsky.feed.like/3jucahkymkk2e bafyreidqrmqvrnz52efgqfavvjdbwob3bc2g3vvgmhmexg app.bsky.feed.like/3jucaj3qgmk2h bafyreig5c2atahtzr2vo4v64aovgqbv6qwivfwf3ex5gn2537wwmtnkm3e [...] -> ./go-export-repo unpack did:plc:ewvi7nxzyoun6zhxrhs64oiz.car +> ./go-export-repo unpack-records did:plc:ewvi7nxzyoun6zhxrhs64oiz.car writing output to: did:plc:ewvi7nxzyoun6zhxrhs64oiz did:plc:ewvi7nxzyoun6zhxrhs64oiz/app.bsky.actor.profile/self.json did:plc:ewvi7nxzyoun6zhxrhs64oiz/app.bsky.feed.like/3jucagnrmn22x.json diff --git a/go-repo-export/main.go b/go-repo-export/main.go index 3e43ab6..ab1ec57 100644 --- a/go-repo-export/main.go +++ b/go-repo-export/main.go @@ -28,11 +28,11 @@ func run() error { return fmt.Errorf("expected two args: ") } switch os.Args[1] { - case "download": + case "download-repo": return carDownload(os.Args[2]) case "list-records": return carList(os.Args[2]) - case "unpack": + case "unpack-records": return carUnpack(os.Args[2]) case "list-blobs": return blobList(os.Args[2]) @@ -82,6 +82,7 @@ func carList(carPath string) error { return err } + // read repository tree in to memory r, err := repo.ReadRepoFromCar(ctx, fi) if err != nil { return err @@ -94,7 +95,6 @@ func carList(carPath string) error { return err } - // extract DID from repo commit fmt.Printf("=== %s ===\n", did) fmt.Println("key\trecord_cid") diff --git a/go-repo-export/test.sh b/go-repo-export/test.sh index 9f8e88d..7c9e8a9 100755 --- a/go-repo-export/test.sh +++ b/go-repo-export/test.sh @@ -5,9 +5,9 @@ set -e set -u go build . -./go-export-repo download atproto.com +./go-export-repo download-repo atproto.com ./go-export-repo list-records did:plc:ewvi7nxzyoun6zhxrhs64oiz.car -./go-export-repo unpack did:plc:ewvi7nxzyoun6zhxrhs64oiz.car +./go-export-repo unpack-records did:plc:ewvi7nxzyoun6zhxrhs64oiz.car ./go-export-repo list-blobs atproto.com ./go-export-repo list-blobs did:plc:ewvi7nxzyoun6zhxrhs64oiz ./go-export-repo download-blobs atproto.com