Skip to content

dev/sg: command, flag, and argument autocompletions

Warren Gifford requested to merge urfave-autocomplete into main

Created by: bobheadxi

Adds a new dependency in sg setup that writes the appropriate completion script for your shell into ~/.sourcegraph and adds a line to your shell config to use the completion script. Completions are generated by sg itself, so there is no need to be able to update this script (and if we do need to update it, we can consider a migration path then)

urfave/cli completions work by providing command suggestions by default, and if you use - TabTab you can get flag completions as well.

Also adds:

  1. Custom completions based on config for sg start, sg run, sg test
  2. Custom completions based on valid values forsg live, sg ci build
  3. sg install --force (i.e. ./sg install --force, now that we can't sg update -local anymore 😢 ) Also adds sg install --profile=false for convenience => https://github.com/sourcegraph/sourcegraph/pull/33822

Stacked on https://github.com/sourcegraph/sourcegraph/pull/33758

Test plan

sg autocompletions

Merge request reports

Loading