+3
-3
cmd/glot/lex_breaking.go
+3
-3
cmd/glot/lex_breaking.go
···
14
14
"github.com/urfave/cli/v3"
15
15
)
16
16
17
-
var cmdBreaking = &cli.Command{
17
+
var cmdLexBreaking = &cli.Command{
18
18
Name: "breaking",
19
19
Usage: "check for changes that break lexicon evolution rules",
20
20
ArgsUsage: `<file-or-dir>*`,
···
30
30
Usage: "output structured JSON",
31
31
},
32
32
},
33
-
Action: runBreaking,
33
+
Action: runLexBreaking,
34
34
}
35
35
36
-
func runBreaking(ctx context.Context, cmd *cli.Command) error {
36
+
func runLexBreaking(ctx context.Context, cmd *cli.Command) error {
37
37
return runComparisons(ctx, cmd, compareBreaking)
38
38
}
39
39
+3
-3
cmd/glot/lex_check_dns.go
+3
-3
cmd/glot/lex_check_dns.go
···
11
11
"github.com/urfave/cli/v3"
12
12
)
13
13
14
-
var cmdCheckDNS = &cli.Command{
14
+
var cmdLexCheckDNS = &cli.Command{
15
15
Name: "check-dns",
16
16
Usage: "checks for any schemas missing DNS NSID resolution",
17
17
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.",
···
29
29
Value: "did:web:lex.example.com",
30
30
},
31
31
},
32
-
Action: runCheckDNS,
32
+
Action: runLexCheckDNS,
33
33
}
34
34
35
35
/*
···
37
37
- resolve and record any missing
38
38
- print DNS configuration instructions
39
39
*/
40
-
func runCheckDNS(ctx context.Context, cmd *cli.Command) error {
40
+
func runLexCheckDNS(ctx context.Context, cmd *cli.Command) error {
41
41
42
42
// collect all NSID/path mappings
43
43
localSchemas, err := collectSchemaJSON(cmd)
+3
-3
cmd/glot/lex_codegen.go
+3
-3
cmd/glot/lex_codegen.go
···
16
16
"golang.org/x/tools/imports"
17
17
)
18
18
19
-
var cmdCodegen = &cli.Command{
19
+
var cmdLexCodegen = &cli.Command{
20
20
Name: "codegen",
21
21
Usage: "output Go code (types) for indicated lexicon schemas",
22
22
Description: "Enumerates all local lexicons (JSON files), and outputs Go source file for each.\nOperates on entire ./lexicons/ directory unless specific files or directories are provided.",
···
39
39
Usage: "skip cleanup of go imports in writen output",
40
40
},
41
41
},
42
-
Action: runCodegen,
42
+
Action: runLexCodegen,
43
43
}
44
44
45
-
func runCodegen(ctx context.Context, cmd *cli.Command) error {
45
+
func runLexCodegen(ctx context.Context, cmd *cli.Command) error {
46
46
47
47
// enumerate lexicon JSON file paths
48
48
filePaths, err := collectPaths(cmd)
+3
-3
cmd/glot/lex_diff.go
+3
-3
cmd/glot/lex_diff.go
···
14
14
"github.com/yudai/gojsondiff/formatter"
15
15
)
16
16
17
-
var cmdDiff = &cli.Command{
17
+
var cmdLexDiff = &cli.Command{
18
18
Name: "diff",
19
19
Usage: "print differences for any updated lexicon schemas",
20
20
ArgsUsage: `<file-or-dir>*`,
···
26
26
Sources: cli.EnvVars("LEXICONS_DIR"),
27
27
},
28
28
},
29
-
Action: runDiff,
29
+
Action: runLexDiff,
30
30
}
31
31
32
-
func runDiff(ctx context.Context, cmd *cli.Command) error {
32
+
func runLexDiff(ctx context.Context, cmd *cli.Command) error {
33
33
return runComparisons(ctx, cmd, compareDiff)
34
34
}
35
35
+3
-3
cmd/glot/lex_lint.go
+3
-3
cmd/glot/lex_lint.go
···
19
19
ErrLintFailures = lexlint.ErrLintFailures
20
20
)
21
21
22
-
var cmdLint = &cli.Command{
22
+
var cmdLexLint = &cli.Command{
23
23
Name: "lint",
24
24
Usage: "check schema syntax, best practices, and style",
25
25
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.",
···
36
36
Usage: "output structured JSON",
37
37
},
38
38
},
39
-
Action: runLint,
39
+
Action: runLexLint,
40
40
}
41
41
42
-
func runLint(ctx context.Context, cmd *cli.Command) error {
42
+
func runLexLint(ctx context.Context, cmd *cli.Command) error {
43
43
44
44
// enumerate lexicon JSON file paths
45
45
filePaths, err := collectPaths(cmd)
+3
-3
cmd/glot/lex_new.go
+3
-3
cmd/glot/lex_new.go
···
25
25
//go:embed lexicon-templates/procedure.json
26
26
var tmplProcedure string
27
27
28
-
var cmdNew = &cli.Command{
28
+
var cmdLexNew = &cli.Command{
29
29
Name: "new",
30
30
Usage: "create new lexicon schema from template",
31
31
ArgsUsage: "<schema-type> <nsid>",
···
51
51
Usage: "list available templates (schema types)",
52
52
},
53
53
},
54
-
Action: runNew,
54
+
Action: runLexNew,
55
55
}
56
56
57
-
func runNew(ctx context.Context, cmd *cli.Command) error {
57
+
func runLexNew(ctx context.Context, cmd *cli.Command) error {
58
58
59
59
if cmd.Bool("list-templates") {
60
60
fmt.Println("Available schema templates:")
+3
-3
cmd/glot/lex_publish.go
+3
-3
cmd/glot/lex_publish.go
···
16
16
"github.com/urfave/cli/v3"
17
17
)
18
18
19
-
var cmdPublish = &cli.Command{
19
+
var cmdLexPublish = &cli.Command{
20
20
Name: "publish",
21
21
Usage: "upload any new or updated lexicons",
22
22
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 (note that this can clobber any existing records).\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.",
···
49
49
Usage: "update existing schema records",
50
50
},
51
51
},
52
-
Action: runPublish,
52
+
Action: runLexPublish,
53
53
}
54
54
55
55
/*
···
60
60
- optionally filter schemas where group DNS is not current account (control w/ arg)
61
61
- publish remaining schemas
62
62
*/
63
-
func runPublish(ctx context.Context, cmd *cli.Command) error {
63
+
func runLexPublish(ctx context.Context, cmd *cli.Command) error {
64
64
65
65
user := cmd.String("username")
66
66
pass := cmd.String("password")
+4
-3
cmd/glot/lex_pull.go
+4
-3
cmd/glot/lex_pull.go
···
19
19
"github.com/urfave/cli/v3"
20
20
)
21
21
22
-
var cmdPull = &cli.Command{
22
+
var cmdLexPull = &cli.Command{
23
23
Name: "pull",
24
24
Usage: "fetch (or update) lexicon schemas to local directory",
25
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.",
···
43
43
Sources: cli.EnvVars("LEXICONS_DIR"),
44
44
},
45
45
},
46
-
Action: runPull,
46
+
Action: runLexPull,
47
47
}
48
48
49
-
func runPull(ctx context.Context, cmd *cli.Command) error {
49
+
func runLexPull(ctx context.Context, cmd *cli.Command) error {
50
50
if !cmd.Args().Present() {
51
51
cli.ShowSubcommandHelpAndExit(cmd, 1)
52
52
}
···
112
112
if err == nil {
113
113
err = sf.FinishParse()
114
114
}
115
+
// NOTE: not calling CheckSchema()
115
116
if err != nil {
116
117
return fmt.Errorf("schema record syntax invalid (%s): %w", nsid, err)
117
118
}
+3
-3
cmd/glot/lex_status.go
+3
-3
cmd/glot/lex_status.go
···
12
12
"github.com/urfave/cli/v3"
13
13
)
14
14
15
-
var cmdStatus = &cli.Command{
15
+
var cmdLexStatus = &cli.Command{
16
16
Name: "status",
17
17
Usage: "check if local lexicons are in-sync with live network",
18
18
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.",
···
25
25
Sources: cli.EnvVars("LEXICONS_DIR"),
26
26
},
27
27
},
28
-
Action: runStatus,
28
+
Action: runLexStatus,
29
29
}
30
30
31
-
func runStatus(ctx context.Context, cmd *cli.Command) error {
31
+
func runLexStatus(ctx context.Context, cmd *cli.Command) error {
32
32
return runComparisons(ctx, cmd, compareStatus)
33
33
}
34
34
+3
-3
cmd/glot/lex_unpublish.go
+3
-3
cmd/glot/lex_unpublish.go
···
13
13
"github.com/urfave/cli/v3"
14
14
)
15
15
16
-
var cmdUnpublish = &cli.Command{
16
+
var cmdLexUnpublish = &cli.Command{
17
17
Name: "unpublish",
18
18
Usage: "delete lexicon schema records from current account",
19
19
Description: "Deletes published schema records from current AT account repository.\nDoes not delete local schema JSON files.",
···
32
32
Sources: cli.EnvVars("GLOT_PASSWORD", "ATP_PASSWORD", "PASSWORD"),
33
33
},
34
34
},
35
-
Action: runUnpublish,
35
+
Action: runLexUnpublish,
36
36
}
37
37
38
-
func runUnpublish(ctx context.Context, cmd *cli.Command) error {
38
+
func runLexUnpublish(ctx context.Context, cmd *cli.Command) error {
39
39
40
40
if cmd.Args().Len() == 0 {
41
41
cli.ShowSubcommandHelpAndExit(cmd, 1)
+10
-10
cmd/glot/main.go
+10
-10
cmd/glot/main.go
···
30
30
Version: versioninfo.Short(),
31
31
}
32
32
app.Commands = []*cli.Command{
33
-
cmdLint,
34
-
cmdPull,
35
-
cmdStatus,
36
-
cmdDiff,
37
-
cmdBreaking,
38
-
cmdNew,
39
-
cmdPublish,
40
-
cmdUnpublish,
41
-
cmdCheckDNS,
42
-
cmdCodegen,
33
+
cmdLexLint,
34
+
cmdLexPull,
35
+
cmdLexStatus,
36
+
cmdLexDiff,
37
+
cmdLexBreaking,
38
+
cmdLexNew,
39
+
cmdLexPublish,
40
+
cmdLexUnpublish,
41
+
cmdLexCheckDNS,
42
+
cmdLexCodegen,
43
43
}
44
44
return app.Run(context.Background(), args)
45
45
}