Skip to content

Commit

Permalink
refactor: remove help topics from the CLI (#7275)
Browse files Browse the repository at this point in the history
It is complicated to present these:
- markdown doesn't look great in a terminal output
- the column width needs artificial limitation for terminal display
- it's hard to discover they exist when running 'aspect help'
- we want to show them on the docsite also, which makes it harder for
non-programmer tech writers to edit
- when/if we rewrite the CLI core, we'll probably want a different way
- we already have 'aspect docs' that can open things in the browser

Replaces #7100

Note that it has a subtle effect of:
- removing a copy of these from being Apache 2 OSS in
https://github.com/aspect-build/aspect-cli/tree/main/docs/help/topics
- These are now versioned at head, rather than with the version of the
CLI you're running.

---

### Changes are visible to end-users: no

GitOrigin-RevId: d7dcf02fa93dcf8fc1776deb1372b9715ca7b49a
  • Loading branch information
alexeagle authored and jbedard committed Nov 7, 2024
1 parent 2a2625b commit 41d6e41
Show file tree
Hide file tree
Showing 29 changed files with 20 additions and 532 deletions.
2 changes: 1 addition & 1 deletion bazel/action_cache/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")
load("//bazel/ts:defs.bzl", "ts_proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")

proto_library(
name = "bazel_proto",
Expand Down
2 changes: 1 addition & 1 deletion bazel/analysis/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")
load("//bazel/ts:defs.bzl", "ts_proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")

proto_library(
name = "bazel_proto",
Expand Down
2 changes: 1 addition & 1 deletion bazel/buildeventstream/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")
load("//bazel/ts:defs.bzl", "ts_proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")

proto_library(
name = "buildeventstream_proto",
Expand Down
2 changes: 1 addition & 1 deletion bazel/command_line/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")
load("//bazel/ts:defs.bzl", "ts_proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")

proto_library(
name = "command_line_proto",
Expand Down
2 changes: 1 addition & 1 deletion bazel/failure_details/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")
load("//bazel/ts:defs.bzl", "ts_proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")

proto_library(
name = "failure_details_proto",
Expand Down
2 changes: 1 addition & 1 deletion bazel/flags/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")
load("//bazel/ts:defs.bzl", "ts_proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")

proto_library(
name = "bazel_proto",
Expand Down
2 changes: 1 addition & 1 deletion bazel/invocation_policy/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")
load("//bazel/ts:defs.bzl", "ts_proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")

proto_library(
name = "invocation_policy_proto",
Expand Down
2 changes: 1 addition & 1 deletion bazel/options/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")
load("//bazel/ts:defs.bzl", "ts_proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")

proto_library(
name = "options_proto",
Expand Down
2 changes: 1 addition & 1 deletion bazel/packages_metrics/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")
load("//bazel/ts:defs.bzl", "ts_proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")

proto_library(
name = "devtools_build_lib_packages_metrics_proto",
Expand Down
2 changes: 1 addition & 1 deletion bazel/query/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")
load("//bazel/ts:defs.bzl", "ts_proto_library")
load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files")

proto_library(
name = "blaze_query_aspect_mirror_proto",
Expand Down
Empty file removed bazel/ts/BUILD.bazel
Empty file.
75 changes: 0 additions & 75 deletions bazel/ts/defs.bzl

This file was deleted.

1 change: 0 additions & 1 deletion cmd/aspect/root/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ go_library(
"//cmd/aspect/sync",
"//cmd/aspect/test",
"//cmd/aspect/version",
"//docs/help/topics",
"//pkg/aspect/root/flags",
"//pkg/aspecterrors",
"//pkg/bazel",
Expand Down
32 changes: 0 additions & 32 deletions cmd/aspect/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import (
"aspect.build/cli/cmd/aspect/sync"
"aspect.build/cli/cmd/aspect/test"
"aspect.build/cli/cmd/aspect/version"
help_docs "aspect.build/cli/docs/help/topics"
"aspect.build/cli/pkg/aspect/root/flags"
"aspect.build/cli/pkg/aspecterrors"
"aspect.build/cli/pkg/bazel"
Expand Down Expand Up @@ -167,36 +166,5 @@ func NewCmd(
cmd.AddCommand(configure.NewDefaultCmd())
}

// ### "Additional help topic commands" which are not runnable
// https://pkg.go.dev/github.com/spf13/cobra#Command.IsAdditionalHelpTopicCommand
cmd.AddCommand(&cobra.Command{
Use: "target-syntax",
Short: "Explains the syntax for specifying targets.",
Long: mustReadFile("target-syntax.md"),
})
cmd.AddCommand(&cobra.Command{
Use: "info-keys",
Short: "Displays a list of keys used by the info command.",
Long: mustReadFile("info-keys.md"),
})
cmd.AddCommand(&cobra.Command{
Use: "tags",
Short: "Conventions for tags which are special.",
Long: mustReadFile("tags.md"),
})
cmd.AddCommand(&cobra.Command{
Use: "directives",
Short: "Special comments in BUILD files which instruct Aspect CLI behaviors",
Long: mustReadFile("directives.md"),
})

return cmd
}

func mustReadFile(f string) string {
result, err := help_docs.Content.ReadFile(f)
if err != nil {
panic(fmt.Errorf("Internal error: embed data was not readable: %w", err))
}
return string(result)
}
2 changes: 1 addition & 1 deletion docs/bazelrc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ go_library(
"convenience.bazelrc",
"correctness.bazelrc",
"debug.bazelrc",
"java.bazelrc",
"javascript.bazelrc",
"performance.bazelrc",
"java.bazelrc",
],
importpath = "aspect.build/cli/docs/bazelrc",
visibility = ["//visibility:public"],
Expand Down
14 changes: 0 additions & 14 deletions docs/help/topics/BUILD.bazel

This file was deleted.

95 changes: 0 additions & 95 deletions docs/help/topics/directives.md

This file was deleted.

23 changes: 0 additions & 23 deletions docs/help/topics/doc.go

This file was deleted.

Loading

0 comments on commit 41d6e41

Please sign in to comment.