feat: add 'repo update' command

Description

This PR adds a repo update command to the GitLab CLI, addressing #914 (closed). This will allow editing repository information after the repo has been created (such as the description and default branch). It accepts the syntax

glab repo update <project> [--description foo] [--defaultBranch bar]

The syntax here is designed to be identical to the repo create command for simplicity.

Currently, the only fields modifiable with this command are description and default_branch. However, it is trivial to enable modification of extra fields. If someone would like a specific field, I'm happy to add it in this PR - let me know.

Although the API uses the verb 'edit', we chose to use 'update' here to be consistent with the rest of the glab CLI.

The <project> field should have identical syntax to the repo view command. Namely, it will accept the following formats:

  • no argument provided (assume the current dir is a GitLab repo and edit the corresponding repo)
  • project name (need to look up the username and prefix it with a slash)
  • user/project (can be passed verbatim to the API)
  • fully qualified GitLab URL

Related Issues

Resolves #914 (closed)

How has this been tested?

Manual testing using my own repo namespace. Full suite of unit tests provided.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap
Edited by Jordan Barrett

Merge request reports

Loading