feat: add --template flag to issue and mr create commands

What does this MR do and why?

Adds a --template flag to both glab issue create and glab mr create that pre-populates the description from a local template file, providing a non-interactive equivalent to the template selection prompt.

Usage

# Use a template by name (with or without .md extension)
glab issue create -t "Bug Report" --template bug
glab issue create -t "Feature Request" --template feature_proposal.md --yes

glab mr create -t "Fix login bug" --template bug_fix
glab mr create -t "Security patch" --template security_fix.md --yes

Templates are loaded from .gitlab/issue_templates/ and .gitlab/merge_request_templates/ in the local repository. Loading templates from remote repositories is not supported (pre-existing limitation, see TODO in cmdutils.go).

MR acceptance checklist

  • This MR does not have a documentation impact, or the documentation has been included/updated in this MR

  • The MR title and description are informative

  • Tests have been added/updated to cover the changes

  • Resolves #8087 (closed)

  • Resolves #7924 (closed)

  • Related to !2663 (closed) and !2751 (closed)

Edited by Kai Armstrong

Merge request reports

Loading