Adds push, list, get, delete, and login subcommands backed by an HTTP API client, plus an MCP server for tool-based access to the document queue. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
35 lines
578 B
Go
35 lines
578 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func getCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "get <slug>",
|
|
Short: "Get a document's markdown body",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(_ *cobra.Command, args []string) error {
|
|
c, err := newClient()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
doc, err := c.GetDocument(context.Background(), args[0])
|
|
if err != nil {
|
|
return fmt.Errorf("get document: %w", err)
|
|
}
|
|
|
|
_, _ = fmt.Fprint(os.Stdout, doc.Body)
|
|
return nil
|
|
},
|
|
}
|
|
|
|
addClientFlags(cmd)
|
|
return cmd
|
|
}
|