this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

glot: add a bunch of longer usage descriptions

+53 -29
+4 -3
cmd/glot/dns.go
··· 17 17 ) 18 18 19 19 var cmdCheckDNS = &cli.Command{ 20 - Name: "check-dns", 21 - Usage: "checks for any schemas missing DNS NSID resolution", 22 - ArgsUsage: `<file-or-dir>*`, 20 + Name: "check-dns", 21 + Usage: "checks for any schemas missing DNS NSID resolution", 22 + 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.", 23 + ArgsUsage: `<file-or-dir>*`, 23 24 Flags: []cli.Flag{ 24 25 &cli.StringFlag{ 25 26 Name: "lexicons-dir",
+4 -3
cmd/glot/lint.go
··· 26 26 ) 27 27 28 28 var cmdLint = &cli.Command{ 29 - Name: "lint", 30 - Usage: "check schema style", 31 - ArgsUsage: `<file-or-dir>*`, 29 + Name: "lint", 30 + Usage: "check schema syntax, best practices, and style", 31 + 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.", 32 + ArgsUsage: `<file-or-dir>*`, 32 33 Flags: []cli.Flag{ 33 34 &cli.StringFlag{ 34 35 Name: "lexicons-dir",
+4 -3
cmd/glot/main.go
··· 24 24 func run(args []string) error { 25 25 26 26 app := cli.Command{ 27 - Name: "glot", 28 - Usage: "AT Lexicon Tool", 29 - Version: versioninfo.Short(), 27 + Name: "glot", 28 + Usage: "ATProto Lexicon Schema Tool", 29 + 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", 30 + Version: versioninfo.Short(), 30 31 } 31 32 app.Commands = []*cli.Command{ 32 33 cmdLint,
+8 -3
cmd/glot/new.go
··· 26 26 var tmplProcedure string 27 27 28 28 var cmdNew = &cli.Command{ 29 - Name: "new", 30 - Usage: "create new lexicon schema from template", 31 - //ArgsUsage: `<schema-type> <nsid>`, 29 + Name: "new", 30 + Usage: "create new lexicon schema from template", 31 + ArgsUsage: "<schema-type> <nsid>", 32 + Description: "Instantiates new schemas (JSON files) from templates, with provided NSID substituted.", 32 33 Arguments: []cli.Argument{ 33 34 &cli.StringArg{ 34 35 Name: "schema-type", ··· 63 64 fmt.Println(" query-list") 64 65 fmt.Println(" procedure") 65 66 return nil 67 + } 68 + 69 + if cmd.StringArg("nsid") == "" { 70 + cli.ShowSubcommandHelpAndExit(cmd, 1) 66 71 } 67 72 68 73 nsid, err := syntax.ParseNSID(cmd.StringArg("nsid"))
+16 -7
cmd/glot/publish.go
··· 21 21 ) 22 22 23 23 var cmdPublish = &cli.Command{ 24 - Name: "publish", 25 - Usage: "upload any new or updated lexicons", 26 - ArgsUsage: `<file-or-dir>*`, 24 + Name: "publish", 25 + Usage: "upload any new or updated lexicons", 26 + 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.", 27 + ArgsUsage: `<file-or-dir>*`, 27 28 Flags: []cli.Flag{ 28 29 &cli.StringFlag{ 29 30 Name: "lexicons-dir", ··· 44 45 Sources: cli.EnvVars("GLOT_PASSWORD", "ATP_PASSWORD", "PASSWORD"), 45 46 }, 46 47 &cli.BoolFlag{ 47 - Name: "force", 48 - Aliases: []string{"f"}, 49 - Usage: "skip NSID DNS resolution match requirement", 48 + Name: "skip-dns-check", 49 + Usage: "skip NSID DNS resolution match requirement", 50 + }, 51 + &cli.BoolFlag{ 52 + Name: "update", 53 + Aliases: []string{"u"}, 54 + Usage: "update existing schema records", 50 55 }, 51 56 }, 52 57 Action: runPublish, ··· 168 173 169 174 // skip if no change 170 175 if remoteJSON != nil { 176 + if !cmd.Bool("update") { 177 + fmt.Printf(" 🟠 %s\n", nsid) 178 + } 179 + 171 180 local, err := data.UnmarshalJSON(localJSON) 172 181 if err != nil { 173 182 return err ··· 183 192 } 184 193 } 185 194 186 - if !cmd.Bool("force") { 195 + if !cmd.Bool("skip-dns-check") { 187 196 g := nsidGroup(nsid) 188 197 did, ok := groupResolution[g] 189 198 if !ok || did != *c.AccountDID {
+5 -4
cmd/glot/pull.go
··· 20 20 ) 21 21 22 22 var cmdPull = &cli.Command{ 23 - Name: "pull", 24 - Usage: "fetch (or update) lexicon schemas to local directory", 25 - ArgsUsage: `<nsid-pattern>+`, 23 + Name: "pull", 24 + Usage: "fetch (or update) lexicon schemas to local directory", 25 + 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.", 26 + ArgsUsage: `<nsid-pattern>+`, 26 27 Flags: []cli.Flag{ 27 28 &cli.StringFlag{ 28 29 Name: "lexicons-dir", ··· 42 43 43 44 func runPull(ctx context.Context, cmd *cli.Command) error { 44 45 if !cmd.Args().Present() { 45 - return fmt.Errorf("no NSID patterns specified") 46 + cli.ShowSubcommandHelpAndExit(cmd, 1) 46 47 } 47 48 48 49 for _, p := range cmd.Args().Slice() {
+4 -3
cmd/glot/status.go
··· 24 24 ) 25 25 26 26 var cmdStatus = &cli.Command{ 27 - Name: "status", 28 - Usage: "check if local lexicons are in-sync with live network", 29 - ArgsUsage: `<file-or-dir>*`, 27 + Name: "status", 28 + Usage: "check if local lexicons are in-sync with live network", 29 + 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.", 30 + ArgsUsage: `<file-or-dir>*`, 30 31 Flags: []cli.Flag{ 31 32 &cli.StringFlag{ 32 33 Name: "lexicons-dir",
+8 -3
cmd/glot/unpublish.go
··· 14 14 ) 15 15 16 16 var cmdUnpublish = &cli.Command{ 17 - Name: "unpublish", 18 - Usage: "delete lexicon schema records from current account", 19 - ArgsUsage: `<nsid>+`, 17 + Name: "unpublish", 18 + Usage: "delete lexicon schema records from current account", 19 + Description: "Deletes published schema records from current AT account repository.\nDoes not delete local schema JSON files.", 20 + ArgsUsage: `<nsid>+`, 20 21 Flags: []cli.Flag{ 21 22 &cli.StringFlag{ 22 23 Name: "username", ··· 35 36 } 36 37 37 38 func runUnpublish(ctx context.Context, cmd *cli.Command) error { 39 + 40 + if cmd.Args().Len() == 0 { 41 + cli.ShowSubcommandHelpAndExit(cmd, 1) 42 + } 38 43 39 44 user := cmd.String("username") 40 45 pass := cmd.String("password")