···48484949func loadAuthClient(ctx context.Context) (*xrpc.Client, error) {
50505151- // TODO: could also load from env var / cctx
5151+ // TODO: could also load from env var / cmd
52525353 fPath, err := xdg.SearchStateFile("goat/auth-session.json")
5454 if err != nil {
+15-19
blob.go
···1010 comatproto "github.com/bluesky-social/indigo/api/atproto"
1111 "github.com/bluesky-social/indigo/xrpc"
12121313- "github.com/urfave/cli/v2"
1313+ "github.com/urfave/cli/v3"
1414)
15151616var cmdBlob = &cli.Command{
1717 Name: "blob",
1818 Usage: "sub-commands for blobs",
1919 Flags: []cli.Flag{},
2020- Subcommands: []*cli.Command{
2020+ Commands: []*cli.Command{
2121 &cli.Command{
2222 Name: "export",
2323 Usage: "download all blobs for given account",
···6666 },
6767}
68686969-func runBlobExport(cctx *cli.Context) error {
7070- ctx := context.Background()
7171- username := cctx.Args().First()
6969+func runBlobExport(ctx context.Context, cmd *cli.Command) error {
7070+ username := cmd.Args().First()
7271 if username == "" {
7372 return fmt.Errorf("need to provide username as an argument")
7473 }
···7776 return err
7877 }
79788080- pdsHost := cctx.String("pds-host")
7979+ pdsHost := cmd.String("pds-host")
8180 if pdsHost == "" {
8281 pdsHost = ident.PDSEndpoint()
8382 }
···9190 return fmt.Errorf("no PDS endpoint for identity")
9291 }
93929494- topDir := cctx.String("output")
9393+ topDir := cmd.String("output")
9594 if topDir == "" {
9695 topDir = fmt.Sprintf("%s_blobs", username)
9796 }
···130129 return nil
131130}
132131133133-func runBlobList(cctx *cli.Context) error {
134134- ctx := context.Background()
135135- username := cctx.Args().First()
132132+func runBlobList(ctx context.Context, cmd *cli.Command) error {
133133+ username := cmd.Args().First()
136134 if username == "" {
137135 return fmt.Errorf("need to provide username as an argument")
138136 }
···168166 return nil
169167}
170168171171-func runBlobDownload(cctx *cli.Context) error {
172172- ctx := context.Background()
173173- username := cctx.Args().First()
169169+func runBlobDownload(ctx context.Context, cmd *cli.Command) error {
170170+ username := cmd.Args().First()
174171 if username == "" {
175172 return fmt.Errorf("need to provide username as an argument")
176173 }
177177- if cctx.Args().Len() < 2 {
174174+ if cmd.Args().Len() < 2 {
178175 return fmt.Errorf("need to provide blob CID as second argument")
179176 }
180180- blobCID := cctx.Args().Get(1)
177177+ blobCID := cmd.Args().Get(1)
181178 ident, err := resolveIdent(ctx, username)
182179 if err != nil {
183180 return err
···192189 return fmt.Errorf("no PDS endpoint for identity")
193190 }
194191195195- blobPath := cctx.String("output")
192192+ blobPath := cmd.String("output")
196193 if blobPath == "" {
197194 blobPath = blobCID
198195 }
···209206 return os.WriteFile(blobPath, blobBytes, 0666)
210207}
211208212212-func runBlobUpload(cctx *cli.Context) error {
213213- ctx := context.Background()
214214- blobPath := cctx.Args().First()
209209+func runBlobUpload(ctx context.Context, cmd *cli.Command) error {
210210+ blobPath := cmd.Args().First()
215211 if blobPath == "" {
216212 return fmt.Errorf("need to provide file path as an argument")
217213 }
+4-5
bsky.go
···99 "github.com/bluesky-social/indigo/atproto/syntax"
1010 lexutil "github.com/bluesky-social/indigo/lex/util"
11111212- "github.com/urfave/cli/v2"
1212+ "github.com/urfave/cli/v3"
1313)
14141515var cmdBsky = &cli.Command{
1616 Name: "bsky",
1717 Usage: "sub-commands for bsky app",
1818 Flags: []cli.Flag{},
1919- Subcommands: []*cli.Command{
1919+ Commands: []*cli.Command{
2020 &cli.Command{
2121 Name: "post",
2222 Usage: "create a post",
···2727 },
2828}
29293030-func runBskyPost(cctx *cli.Context) error {
3131- ctx := context.Background()
3232- text := cctx.Args().First()
3030+func runBskyPost(ctx context.Context, cmd *cli.Command) error {
3131+ text := cmd.Args().First()
3332 if text == "" {
3433 return fmt.Errorf("need to provide post text as argument")
3534 }