Skip to content

Commit

Permalink
go-repo-export$: more polish
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Nov 4, 2023
1 parent 4756a66 commit e806736
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions go-repo-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ go build ./...
Commands which talk to the target account's PDS instance:

```shell
go-export-repo download <at-identifier>
go-export-repo download-repo <at-identifier>
go-export-repo list-blobs <at-identifier>
go-export-repo download-blobs <at-identifier>
```
Expand All @@ -40,13 +40,13 @@ Which work with a local repo CAR file:

```shell
go-export-repo list-records <did.car>
go-export-repo unpack <did.car>
go-export-repo unpack-records <did.car>
```

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

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions go-repo-export/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ func run() error {
return fmt.Errorf("expected two args: <command> <target>")
}
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])
Expand Down Expand Up @@ -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
Expand All @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions go-repo-export/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e806736

Please sign in to comment.