Commit Graph

6 Commits

Author SHA1 Message Date
Robert Lin
b28b962fba
sg: improve positional completions (#58569)
Improves positional completions added for `sg msp` in #58538 by checking for partial flag input (`-` and `--`), which now complete flags correctly, and also improving the way we build positional argument completions with a more robust helper, `completions.CompletePositionalArgs`.
2023-11-27 16:30:59 -08:00
Robert Lin
4b32a70bd8
sg/msp: add completions for services and environments (#58538)
This change adds completions for services and environments on MSP commands. The original plan was to use a `-e` flag based on feedback from @jhchabran , but after playing around with it a bit I think posargs with completions is easier to implement and much more ergonomic: https://github.com/sourcegraph/sourcegraph/pull/58538#discussion_r1404598941

## Test plan

Relevant commands:

```
sg msp gen -all msp-testbed
sg msp tfc sync -all msp-testbed
```

Completions:

https://github.com/sourcegraph/sourcegraph/assets/23356519/1ddb7cb4-ec07-4fc7-a2b6-259e79028b8d
2023-11-24 11:20:59 -08:00
Jean-Hadrien Chabran
bc5490c4bb
bazel: introduce build files for Go (#46770) 2023-01-23 14:00:01 +01:00
Robert Lin
40eedcac19
monitoring: extract into a submodule (#45786)
This change extracts `monitoring` into a submodule for import in `sourcegraph/controller` (https://github.com/sourcegraph/controller/pull/195) so that we can generate dashboards for Cloud instances. These steps were required:

1. Initialize a `go.mod` in `monitoring`
2. Extract `dev/sg/internal/cliutil` into `lib` to avoid illegal imports from `monitoring`
3. Add local replaces to both `sourcegraph/sourcegraph` and `monitoring`
4. `go mod tidy` on all submodules
5. Update `go generate ./monitoring` commands to use `sg`, since the `go generate` command no longer works
6. Update `grafana/build.sh`, `prometheus/build.sh` to build the submodule
7. Amend linters to check for multiple `go.mod` files and ban imports of `github.com/sourcegraph/sourcegraph`
8. Update `sg generate go` to run in directories rather than from root

The only caveat is that if you use VS code, you will now need to open `monitoring` in a separate workspace or similar, like with `lib`.

Co-authored-by: Joe Chen <joe@sourcegraph.com>
2022-12-19 17:49:25 +00:00
Michael Lin
da33822500
lib/cliutil: help is rendering empty text (#44830) 2022-11-25 16:32:40 -08:00
Robert Lin
417dc18619
lib/cliutil: create package for exporting urfave/cli utilities (#44826)
Move sg's docgen code into lib/cliutil/docgen for sharing with the mi CLI. In the future we can move other useful utilities for urfave/cli and CLIs in general into this set of subpackages for use in mi.
2022-11-25 21:15:19 +00:00