···1717)
18181919var cmdCheckDNS = &cli.Command{
2020- Name: "check-dns",
2121- Usage: "checks for any schemas missing DNS NSID resolution",
2222- ArgsUsage: `<file-or-dir>*`,
2020+ Name: "check-dns",
2121+ Usage: "checks for any schemas missing DNS NSID resolution",
2222+ Description: "Checks DNS resolution status for all local lexicons. If un-resolvable NSID groups are discovered, prints instructions on how to configure DNS resolution.\nOperates on entire ./lexicons/ directory unless specific files or directories are provided.",
2323+ ArgsUsage: `<file-or-dir>*`,
2324 Flags: []cli.Flag{
2425 &cli.StringFlag{
2526 Name: "lexicons-dir",
+4-3
cmd/glot/lint.go
···2626)
27272828var cmdLint = &cli.Command{
2929- Name: "lint",
3030- Usage: "check schema style",
3131- ArgsUsage: `<file-or-dir>*`,
2929+ Name: "lint",
3030+ Usage: "check schema syntax, best practices, and style",
3131+ Description: "Parses lexicon schemas (JSON files) from disk and checks various style and best practice rules. Summarizes status for each file.\nOperates on entire ./lexicons/ directory unless specific files or directories are provided.",
3232+ ArgsUsage: `<file-or-dir>*`,
3233 Flags: []cli.Flag{
3334 &cli.StringFlag{
3435 Name: "lexicons-dir",
+4-3
cmd/glot/main.go
···2424func run(args []string) error {
25252626 app := cli.Command{
2727- Name: "glot",
2828- Usage: "AT Lexicon Tool",
2929- Version: versioninfo.Short(),
2727+ Name: "glot",
2828+ Usage: "ATProto Lexicon Schema Tool",
2929+ Description: "Generic utility for working AT Lexicon schema files: fetching and updating existing public schemas; development and maintenance of new schemas; synchronization with the live network.\nFor more about AT Lexicon language see: https://atproto.com/specs/lexicon",
3030+ Version: versioninfo.Short(),
3031 }
3132 app.Commands = []*cli.Command{
3233 cmdLint,
···2121)
22222323var cmdPublish = &cli.Command{
2424- Name: "publish",
2525- Usage: "upload any new or updated lexicons",
2626- ArgsUsage: `<file-or-dir>*`,
2424+ Name: "publish",
2525+ Usage: "upload any new or updated lexicons",
2626+ Description: "Publishes any new or updated local lexicons to the network, by creating schema records under the authenticated account.\nPublication requires a working AT network account, and appropriate DNS configuration. By default will only publish lexicons with DNS configured for the current account. See 'check-dns' command for configuration help, and '--skip-dns-check' to override.\nChecks schema status against live network and will not re-publish identical schemas, or update schemas by default (use '--update' to skip this check).\nOperates on entire ./lexicons/ directory unless specific files or directories are provided.",
2727+ ArgsUsage: `<file-or-dir>*`,
2728 Flags: []cli.Flag{
2829 &cli.StringFlag{
2930 Name: "lexicons-dir",
···4445 Sources: cli.EnvVars("GLOT_PASSWORD", "ATP_PASSWORD", "PASSWORD"),
4546 },
4647 &cli.BoolFlag{
4747- Name: "force",
4848- Aliases: []string{"f"},
4949- Usage: "skip NSID DNS resolution match requirement",
4848+ Name: "skip-dns-check",
4949+ Usage: "skip NSID DNS resolution match requirement",
5050+ },
5151+ &cli.BoolFlag{
5252+ Name: "update",
5353+ Aliases: []string{"u"},
5454+ Usage: "update existing schema records",
5055 },
5156 },
5257 Action: runPublish,
···168173169174 // skip if no change
170175 if remoteJSON != nil {
176176+ if !cmd.Bool("update") {
177177+ fmt.Printf(" 🟠 %s\n", nsid)
178178+ }
179179+171180 local, err := data.UnmarshalJSON(localJSON)
172181 if err != nil {
173182 return err
···183192 }
184193 }
185194186186- if !cmd.Bool("force") {
195195+ if !cmd.Bool("skip-dns-check") {
187196 g := nsidGroup(nsid)
188197 did, ok := groupResolution[g]
189198 if !ok || did != *c.AccountDID {
+5-4
cmd/glot/pull.go
···2020)
21212222var cmdPull = &cli.Command{
2323- Name: "pull",
2424- Usage: "fetch (or update) lexicon schemas to local directory",
2525- ArgsUsage: `<nsid-pattern>+`,
2323+ Name: "pull",
2424+ Usage: "fetch (or update) lexicon schemas to local directory",
2525+ Description: "Resolves and downloads lexicons, and saves as JSON files in local directory.\nPatterns can be full NSIDs, or \"groups\" ending in '.' or '.*'. Does not recursively fetch sub-groups.\nUse 'status' command to check for missing or out-of-date lexicons which need fetching.",
2626+ ArgsUsage: `<nsid-pattern>+`,
2627 Flags: []cli.Flag{
2728 &cli.StringFlag{
2829 Name: "lexicons-dir",
···42434344func runPull(ctx context.Context, cmd *cli.Command) error {
4445 if !cmd.Args().Present() {
4545- return fmt.Errorf("no NSID patterns specified")
4646+ cli.ShowSubcommandHelpAndExit(cmd, 1)
4647 }
47484849 for _, p := range cmd.Args().Slice() {
+4-3
cmd/glot/status.go
···2424)
25252626var cmdStatus = &cli.Command{
2727- Name: "status",
2828- Usage: "check if local lexicons are in-sync with live network",
2929- ArgsUsage: `<file-or-dir>*`,
2727+ Name: "status",
2828+ Usage: "check if local lexicons are in-sync with live network",
2929+ Description: "Enumerates all local lexicons (JSON files), and checks for changes against the live network\nWill detect new published lexicons under a known lexicon group, but will not discover new groups under the same domain prefix.\nOperates on entire ./lexicons/ directory unless specific files or directories are provided.",
3030+ ArgsUsage: `<file-or-dir>*`,
3031 Flags: []cli.Flag{
3132 &cli.StringFlag{
3233 Name: "lexicons-dir",
+8-3
cmd/glot/unpublish.go
···1414)
15151616var cmdUnpublish = &cli.Command{
1717- Name: "unpublish",
1818- Usage: "delete lexicon schema records from current account",
1919- ArgsUsage: `<nsid>+`,
1717+ Name: "unpublish",
1818+ Usage: "delete lexicon schema records from current account",
1919+ Description: "Deletes published schema records from current AT account repository.\nDoes not delete local schema JSON files.",
2020+ ArgsUsage: `<nsid>+`,
2021 Flags: []cli.Flag{
2122 &cli.StringFlag{
2223 Name: "username",
···3536}
36373738func runUnpublish(ctx context.Context, cmd *cli.Command) error {
3939+4040+ if cmd.Args().Len() == 0 {
4141+ cli.ShowSubcommandHelpAndExit(cmd, 1)
4242+ }
38433944 user := cmd.String("username")
4045 pass := cmd.String("password")