Skip to content

dev/sg: refactor sg teammate to use ffcli subcommands

Warren Gifford requested to merge teammate-cmd-refactor into main

Created by: bobheadxi

Was messing around with https://github.com/agnivade/levenshtein for a bit during lunch to improve suggestions for sg teammate. That experiment didn't amount to much - turns out names are a terrible use case for measuring distance by single-character edits (for example, Eric is meaningfully different from Erik, but only requires a single edit to get there => a good levenshtein score, despite them being two different people). I had thought that it would help with misspellings of names but turns out the false positives were way too much.

However did a bit of fly-by refactoring to make sg teammate use proper ffcli subcommands which makes the help text much better.

Also sneaks in a change to get Slack users info with the provided context

Test plan

go run ./dev/sg teammate ... all works as before. Improved help text:

❯ go run ./dev/sg teammate -h  
USAGE
  sg teammate [time|handbook] <nickname>

Get information about Sourcegraph teammates, such as their current time and handbook page!

SUBCOMMANDS
  time      Get the current time of a Sourcegraph teammate.
  handbook  Open the handbook page of a Sourcegraph teammate.

Merge request reports

Loading