From b38619a01728286bb097ee579a858e751b8a1c79 Mon Sep 17 00:00:00 2001 From: komisan19 Date: Wed, 13 Mar 2024 19:27:40 +0900 Subject: [PATCH] proposal: add bsky cmd with get profile --- cmd/gosky/bsky.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/cmd/gosky/bsky.go b/cmd/gosky/bsky.go index 77ce88d5c..741c1b238 100644 --- a/cmd/gosky/bsky.go +++ b/cmd/gosky/bsky.go @@ -28,6 +28,7 @@ var bskyCmd = &cli.Command{ bskyDeletePostCmd, bskyActorGetSuggestionsCmd, bskyNotificationsCmd, + bskyGetProfileCmd, }, } @@ -351,3 +352,35 @@ var bskyNotificationsCmd = &cli.Command{ return nil }, } + +var bskyGetProfileCmd = &cli.Command{ + Name: "get-profile", + Usage: "print of profile for account", + Action: func(cctx *cli.Context) error { + xrpcc, err := cliutil.GetXrpcClient(cctx, true) + if err != nil { + return err + } + + ctx := context.TODO() + + author := cctx.Args().First() + if author == "" { + author = xrpcc.Auth.Did + } + + resp, err := appbsky.ActorGetProfile(ctx, xrpcc, author) + if err != nil { + return err + } + + r, err := json.Marshal(resp) + if err != nil { + return err + } + + fmt.Println(string(r)) + + return nil + }, +}