docs: add linting and checks to documentation

This commit is contained in:
Kai Armstrong 2022-10-21 14:38:48 +00:00 committed by Gary Holtz
parent 74f5004d57
commit f95b6ea90c
238 changed files with 3203 additions and 1132 deletions

View File

@ -16,6 +16,7 @@ default:
image: golang:1.18
stages:
- review-docs
- test
- release
@ -37,6 +38,15 @@ include:
cache:
paths:
- .go/pkg/mod/
check_docs_markdown:
image: registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.16-vale-2.20.1-markdownlint-0.32.2
stage: review-docs
script:
# Lint prose
- vale --minAlertLevel error docs README.md
# Lint Markdown
- markdownlint --config .markdownlint.yml 'docs/**/*.md' README.md
code_navigation:
stage: test

153
.markdownlint.yml Normal file
View File

@ -0,0 +1,153 @@
---
# Base Markdownlint configuration
# Extended Markdownlint configuration in doc/.markdownlint/
default: true
first-header-h1: true
header-style:
style: "atx"
ul-style:
style: "dash"
no-trailing-spaces: false
line-length: false
no-duplicate-header:
allow_different_nesting: true
no-trailing-punctuation:
punctuation: ".,;:!。,;:!?"
ol-prefix:
style: "one"
no-inline-html: false
hr-style:
style: "---"
no-emphasis-as-heading: false
first-line-h1: false
code-block-style:
style: "fenced"
emphasis-style: false
link-fragments: false
reference-links-images: false
proper-names:
names: [
"Akismet",
"Alertmanager",
"AlmaLinux",
"API",
"Asana",
"Auth0",
"Authentiq",
"Azure",
"Bamboo",
"Bitbucket",
"Bugzilla",
"CAS",
"CentOS",
"Consul",
"Debian",
"DevOps",
"Docker",
"DockerSlim",
"Elasticsearch",
"Facebook",
"fastlane",
"fluent-plugin-redis-slowlog",
"GDK",
"Geo",
"Git LFS",
"git-annex",
"git-credential",
"git-sizer",
"Git",
"Gitaly",
"GitHub",
"GitLab Geo",
"GitLab Monitor",
"GitLab Operator",
"GitLab Pages",
"GitLab Rails",
"GitLab Runner",
"GitLab Shell",
"GitLab Workhorse",
"GitLab",
"Gitleaks",
"Gmail",
"Google",
"Grafana",
"Gzip",
"Helm",
"HipChat",
"ID",
"Ingress",
"jasmine-jquery",
"JavaScript",
"Jaeger",
"Jenkins",
"Jira",
"Jira Cloud",
"Jira Server",
"jQuery",
"JSON",
"JupyterHub",
"Karma",
"Kerberos",
"Knative",
"Kubernetes",
"LDAP",
"Let's Encrypt",
"Markdown",
"markdownlint",
"Mattermost",
"Microsoft",
"minikube",
"MinIO",
"ModSecurity",
"NGINX Ingress",
"NGINX",
"OAuth",
"OAuth 2",
"OmniAuth",
"Omnibus GitLab",
"OpenID",
"OpenShift",
"PgBouncer",
"Postfix",
"PostgreSQL",
"Praefect",
"Prometheus",
"Puma",
"puma-worker-killer",
"Python",
"Rake",
"Redis",
"Redmine",
"reCAPTCHA",
"Ruby",
"runit",
"Salesforce",
"SAML",
"Sendmail",
"Sentry",
"Service Desk",
"Sidekiq",
"Shibboleth",
"Slack",
"SMTP",
"SpotBugs",
"ssh-key",
"SSH",
"Tiller",
"TOML",
"Trello",
"Trello Power-Ups",
"TypeScript",
"Twitter",
"Ubuntu",
"Ultra Auth",
"Unicorn",
"unicorn-worker-killer",
"URL",
"WebdriverIO",
"Workload Identity Pool",
"Workload Identity Provider",
"YAML",
"YouTrack"
]
code_blocks: false

12
.vale.ini Normal file
View File

@ -0,0 +1,12 @@
# Vale configuration file.
#
# For more information, see https://errata-ai.gitbook.io/vale/getting-started/configuration.
StylesPath = docs/.vale
MinAlertLevel = suggestion
[*.md]
BasedOnStyles = gitlab
# Ignore SVG markup
TokenIgnores = (\*\*\{\w*\}\*\*)

View File

@ -15,38 +15,38 @@ GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to
## Table of contents
* [Usage](#usage)
* [Demo](#demo)
* [Documentation](#documentation)
* [Installation](#installation)
* [Quick Install](#quick-install)
* [Windows](#windows)
* [WinGet](#winget)
* [Scoop](#scoop)
* [EXE Installer](#exe-installer)
* [Linux](#linux)
* [Linuxbrew (Homebrew)](#linuxbrew-homebrew)
* [Snapcraft](#snapcraft)
* [Arch Linux](#arch-linux)
* [KISS Linux](#kiss-linux)
* [Alpine Linux](#alpine-linux)
* [Install a pinned version from edge](#install-a-pinned-version-from-edge)
* [Alpine Linux Docker-way](#alpine-linux-docker-way)
* [Nix/NixOS](#nixnixos)
* [MPR (Debian/Ubuntu)](#mpr-debianubuntu)
* [Prebuilt-MPR](#prebuilt-mpr)
* [Spack](#spack)
* [macOS](#macos)
* [Homebrew](#homebrew)
* [MacPorts](#macports)
* [Building From Source](#building-from-source)
* [Prerequisites](#prerequisites-for-building-from-source-are)
* [Authentication](#authentication)
* [Configuration](#configuration)
* [Environment Variables](#environment-variables)
* [What about lab](#what-about-lab)
* [Issues](#issues)
* [Contributing](#contributing)
- [Usage](#usage)
- [Demo](#demo)
- [Documentation](#documentation)
- [Installation](#installation)
- [Quick Install](#quick-install)
- [Windows](#windows)
- [WinGet](#winget)
- [Scoop](#scoop)
- [EXE Installer](#exe-installer)
- [Linux](#linux)
- [Linuxbrew (Homebrew)](#linuxbrew-homebrew)
- [Snapcraft](#snapcraft)
- [Arch Linux](#arch-linux)
- [KISS Linux](#kiss-linux)
- [Alpine Linux](#alpine-linux)
- [Install a pinned version from edge](#install-a-pinned-version-from-edge)
- [Alpine Linux Docker-way](#alpine-linux-docker-way)
- [Nix/NixOS](#nixnixos)
- [MPR (Debian/Ubuntu)](#mpr-debianubuntu)
- [Prebuilt-MPR](#prebuilt-mpr)
- [Spack](#spack)
- [macOS](#macos)
- [Homebrew](#homebrew)
- [MacPorts](#macports)
- [Building From Source](#building-from-source)
- [Prerequisites](#prerequisites-for-building-from-source-are)
- [Authentication](#authentication)
- [Configuration](#configuration)
- [Environment Variables](#environment-variables)
- [What about lab](#what-about-lab)
- [Issues](#issues)
- [Contributing](#contributing)
## Usage
@ -85,7 +85,7 @@ brew upgrade glab
Alternatively, you can install `glab` by shell script:
```shell
curl -s https://gitlab.com/gitlab-org/cli/-/raw/main/scripts/install.sh | sudo sh
curl -s "https://gitlab.com/gitlab-org/cli/-/raw/main/scripts/install.sh" | sudo sh
```
*Installs into `usr/bin`*
@ -146,7 +146,7 @@ brew upgrade glab
1. Make sure you have [snap installed on your Linux distribution](https://snapcraft.io/docs/installing-snapd).
1. `sudo snap install --edge glab`
1. `sudo snap connect glab:ssh-keys` to grant ssh access
1. `sudo snap connect glab:ssh-keys` to grant SSH access
#### Arch Linux
@ -158,7 +158,8 @@ pacman -S glab
#### KISS Linux
> WARNING: It seems that KISS Linux may no longer be actively maintained, so links to its web domain have been removed from this README.
WARNING:
It seems that KISS Linux may no longer be actively maintained, so links to its web domain have been removed from this README.
`glab` is available on the [KISS Linux Community Repository](https://github.com/kisslinux/community) as `gitlab-glab`.
If you already have the community repository configured in your `KISS_PATH` you can install `glab` through your terminal.
@ -285,8 +286,8 @@ If a supported binary for your OS is not found at the [releases page](https://gi
#### Prerequisites for building from source
* `make`
* Go 1.13+
- `make`
- Go 1.13+
1. Verify that you have Go 1.13+ installed
@ -322,25 +323,25 @@ If a supported binary for your OS is not found at the [releases page](https://gi
Get a GitLab access token at <https://gitlab.com/-/profile/personal_access_tokens> or <https://gitlab.example.com/-/profile/personal_access_tokens> if self-managed:
* Start interactive setup:
- Start interactive setup:
```shell
glab auth login
```
* Authenticate against `gitlab.com` by reading the token from a file:
- Authenticate against `gitlab.com` by reading the token from a file:
```shell
glab auth login --stdin < myaccesstoken.txt
```
* Authenticate against a self-managed GitLab instance by reading from a file:
- Authenticate against a self-managed GitLab instance by reading from a file:
```shell
glab auth login --hostname salsa.debian.org --stdin < myaccesstoken.txt
```
* Authenticate with token and hostname. Not recommended for shared environments:
- Authenticate with token and hostname. Not recommended for shared environments:
```shell
glab auth login --hostname gitlab.example.org --token xxxxx
@ -350,23 +351,23 @@ Get a GitLab access token at <https://gitlab.com/-/profile/personal_access_token
By default, `glab` follows the XDG Base Directory [Spec](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html):
* The global configuration file is saved at `~/.config/glab-cli`.
* The local configuration file is saved at `.git/glab-cli` in the current working Git directory.
* Advanced workflows may override the location of the global configuration by setting the `GLAB_CONFIG_DIR` environment variable.
- The global configuration file is saved at `~/.config/glab-cli`.
- The local configuration file is saved at `.git/glab-cli` in the current working Git directory.
- Advanced workflows may override the location of the global configuration by setting the `GLAB_CONFIG_DIR` environment variable.
* **To set configuration globally**
- **To set configuration globally**
```shell
glab config set --global editor vim
```
* **To set configuration for current directory (must be a git repository)**
- **To set configuration for current directory (must be a Git repository)**
```shell
glab config set editor vim
```
* **To set configuration for a specific host**
- **To set configuration for a specific host**
Use the `--host` flag to set configuration for a specific host. This configuration is always stored in the global configuration file, with or without the `global` flag.

View File

@ -122,9 +122,8 @@ func printSubcommands(cmd *cobra.Command, buf *bytes.Buffer) {
}
if subcommands != "" {
buf.WriteString("## Subcommands\n\n")
buf.WriteString("\n## Subcommands\n\n")
buf.WriteString(subcommands)
buf.WriteString("\n")
}
}
@ -181,20 +180,23 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer) error {
buf.WriteString("Please do not edit this file directly, check cmd/gen-docs/docs.go." + "\n")
buf.WriteString("-->" + "\n\n")
buf.WriteString("# " + name + "\n\n")
buf.WriteString(cmd.Short + "\n\n")
buf.WriteString("# `" + name + "`\n\n")
buf.WriteString(cmd.Short + "\n")
if len(cmd.Long) > 0 {
buf.WriteString("## Synopsis\n\n")
buf.WriteString(cmd.Long + "\n\n")
// Skipping `help` commands until Long description can be revised
if cmd.Name() != "help" {
buf.WriteString("\n## Synopsis\n\n")
buf.WriteString(cmd.Long)
}
}
if cmd.Runnable() {
buf.WriteString(fmt.Sprintf("```plaintext\n%s\n```\n\n", cmd.UseLine()))
buf.WriteString(fmt.Sprintf("\n```plaintext\n%s\n```\n", cmd.UseLine()))
}
if len(cmd.Example) > 0 {
buf.WriteString("## Examples\n\n")
buf.WriteString(fmt.Sprintf("```plaintext\n%s\n```\n\n", cmd.Example))
buf.WriteString("\n## Examples\n\n")
buf.WriteString(fmt.Sprintf("```plaintext\n%s\n```\n", cmd.Example))
}
if err := printOptions(buf, cmd, name); err != nil {
@ -212,17 +214,17 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
flags := cmd.NonInheritedFlags()
flags.SetOutput(buf)
if flags.HasAvailableFlags() {
buf.WriteString("### Options\n\n```plaintext\n")
buf.WriteString("\n## Options\n\n```plaintext\n")
flags.PrintDefaults()
buf.WriteString("```\n\n")
buf.WriteString("```\n")
}
parentFlags := cmd.InheritedFlags()
parentFlags.SetOutput(buf)
if parentFlags.HasAvailableFlags() {
buf.WriteString("### Options inherited from parent commands\n\n```plaintext\n")
buf.WriteString("\n## Options inherited from parent commands\n\n```plaintext\n")
parentFlags.PrintDefaults()
buf.WriteString("```\n\n")
buf.WriteString("```\n")
}
return nil
}

View File

@ -44,7 +44,7 @@ func NewCmdSet(f *cmdutils.Factory, runF func(*SetOptions) error) *cobra.Command
arguments, you must explicitly accept them using "$1", "$2", etc., or "$@" to accept all of them.
Platform note: on Windows, shell aliases are executed via "sh" as installed by Git For Windows. If
you have installed git on Windows in some other way, shell aliases may not work for you.
you have installed Git on Windows in some other way, shell aliases may not work for you.
Quotes must always be used when defining a command as in the examples.
`),
Example: heredoc.Doc(`

View File

@ -61,47 +61,50 @@ func NewCmdApi(f *cmdutils.Factory, runF func(*ApiOptions) error) *cobra.Command
cmd := &cobra.Command{
Use: "api <endpoint>",
Short: "Make an authenticated request to GitLab API",
Long: `Makes an authenticated HTTP request to the GitLab API and prints the response.
The endpoint argument should either be a path of a GitLab API v4 endpoint, or
"graphql" to access the GitLab's GraphQL API.
Long: heredoc.Docf(`
Makes an authenticated HTTP request to the GitLab API and prints the response.
The endpoint argument should either be a path of a GitLab API v4 endpoint, or
"graphql" to access the GitLab GraphQL API.
GitLab REST API Docs: https://docs.gitlab.com/ce/api/README.html
GitLab GraphQL Docs: https://docs.gitlab.com/ee/api/graphql/
- [GitLab REST API Docs](https://docs.gitlab.com/ee/api/index.html)
- [GitLab GraphQL Docs](https://docs.gitlab.com/ee/api/graphql/)
If the current directory is a git directory, the GitLab authenticated host in the current git
directory will be used else gitlab.com will be used.
Override the GitLab hostname with '--hostname'.
If the current directory is a Git directory, the GitLab authenticated host in the current
directory will be used otherwise %[1]sgitlab.com%[1]s will be used.
Override the GitLab hostname with '--hostname'.
Placeholder values ":fullpath" or ":id"", ":user" or ":username", ":group", ":namespace",
":repo", and ":branch" in the endpoint argument will get replaced with values from the
repository of the current directory.
Placeholder values %[1]s:fullpath%[1]s or %[1]s:id%[1]s, %[1]s:user%[1]s or %[1]s:username%[1]s, %[1]s:group%[1]s, %[1]s:namespace%[1]s,
%[1]s:repo%[1]s, and %[1]s:branch%[1]s in the endpoint argument will get replaced with values from the
repository of the current directory.
The default HTTP request method is "GET" normally and "POST" if any parameters
were added. Override the method with '--method'.
The default HTTP request method is "GET" normally and "POST" if any parameters
were added. Override the method with '--method'.
Pass one or more '--raw-field' values in "key=value" format to add
JSON-encoded string parameters to the POST body.
Pass one or more '--raw-field' values in "key=value" format to add
JSON-encoded string parameters to the POST body.
The '--field' flag behaves like '--raw-field' with magic type conversion based
on the format of the value:
- literal values "true", "false", "null", and integer numbers get converted to
appropriate JSON types;
- placeholder values ":namespace", ":repo", and ":branch" get populated with values
from the repository of the current directory;
- if the value starts with "@", the rest of the value is interpreted as a
filename to read the value from. Pass "-" to read from standard input.
The '--field' flag behaves like '--raw-field' with magic type conversion based
on the format of the value:
For GraphQL requests, all fields other than "query" and "operationName" are
interpreted as GraphQL variables.
- literal values "true", "false", "null", and integer numbers get converted to
appropriate JSON types;
- placeholder values ":namespace", ":repo", and ":branch" get populated with values
from the repository of the current directory;
- if the value starts with "@", the rest of the value is interpreted as a
filename to read the value from. Pass "-" to read from standard input.
Raw request body may be passed from the outside via a file specified by '--input'.
Pass "-" to read from standard input. In this mode, parameters specified via
'--field' flags are serialized into URL query parameters.
For GraphQL requests, all fields other than "query" and "operationName" are
interpreted as GraphQL variables.
In '--paginate' mode, all pages of results will sequentially be requested until
there are no more pages of results. For GraphQL requests, this requires that the
original query accepts an '$endCursor: String' variable and that it fetches the
'pageInfo{ hasNextPage, endCursor }' set of fields from a collection.`,
Raw request body may be passed from the outside via a file specified by '--input'.
Pass "-" to read from standard input. In this mode, parameters specified via
'--field' flags are serialized into URL query parameters.
In '--paginate' mode, all pages of results will sequentially be requested until
there are no more pages of results. For GraphQL requests, this requires that the
original query accepts an '$endCursor: String' variable and that it fetches the
'pageInfo{ hasNextPage, endCursor }' set of fields from a collection.
`,"`"),
Example: heredoc.Doc(`
$ glab api projects/:fullpath/releases

View File

@ -36,7 +36,7 @@ func NewCmdCredential(f *cmdutils.Factory, runF func(*CredentialOptions) error)
cmd := &cobra.Command{
Use: "git-credential",
Args: cobra.ExactArgs(1),
Short: "Implements git credential helper manager",
Short: "Implements Git credential helper manager",
Hidden: true,
RunE: func(cmd *cobra.Command, args []string) error {
opts.Operation = args[0]

View File

@ -48,16 +48,16 @@ func NewCmdLogin(f *cmdutils.Factory) *cobra.Command {
Long: heredoc.Docf(`
Authenticate with a GitLab instance.
You can pass in a token on standard input by using %[1]s--stdin%[1]s.
The minimum required scopes for the token are: "api", "write_repository".
The minimum required scopes for the token are: %[1]sapi%[1]s, %[1]swrite_repository%[1]s.
`, "`"),
Example: heredoc.Doc(`
Example: heredoc.Docf(`
# start interactive setup
$ glab auth login
# authenticate against gitlab.com by reading the token from a file
# authenticate against %[1]sgitlab.com%[1]s by reading the token from a file
$ glab auth login --stdin < myaccesstoken.txt
# authenticate with a self-hosted GitLab instance
$ glab auth login --hostname salsa.debian.org
`),
`, "`"),
RunE: func(cmd *cobra.Command, args []string) error {
if !opts.IO.PromptEnabled() && !tokenStdin && opts.Token == "" {
return &cmdutils.FlagError{Err: errors.New("--stdin or --token required when not running interactively")}

View File

@ -18,8 +18,8 @@ func NewCmdRun(f *cmdutils.Factory) *cobra.Command {
Short: `Download all Artifacts from the last pipeline`,
Aliases: []string{"push"},
Example: heredoc.Doc(`
$ glab ci artifact main build
$ glab ci artifact main deploy --path="artifacts/"
glab ci artifact main build
glab ci artifact main deploy --path="artifacts/"
`),
Long: ``,
Args: cobra.ExactArgs(2),

View File

@ -19,8 +19,8 @@ func NewCmdDelete(f *cmdutils.Factory) *cobra.Command {
Use: "delete <id> [flags]",
Short: `Delete a CI pipeline`,
Example: heredoc.Doc(`
$ glab ci delete 34
$ glab ci delete 12,34,2
glab ci delete 34
glab ci delete 12,34,2
`),
Long: ``,
Args: cobra.ExactArgs(1),

View File

@ -18,7 +18,7 @@ func NewCmdCI(f *cmdutils.Factory) *cobra.Command {
Use: "ci <command> [flags]",
Short: `Work with GitLab CI pipelines and jobs`,
Example: heredoc.Doc(`
$ glab pipeline ci trace
glab pipeline ci trace
`),
}

View File

@ -19,7 +19,7 @@ import (
func NewCmdLint(f *cmdutils.Factory) *cobra.Command {
var pipelineCILintCmd = &cobra.Command{
Use: "lint",
Short: "Checks if your .gitlab-ci.yml file is valid.",
Short: "Checks if your `.gitlab-ci.yml` file is valid.",
Args: cobra.MaximumNArgs(1),
Example: heredoc.Doc(`
$ glab ci lint

View File

@ -18,8 +18,8 @@ func NewCmdList(f *cmdutils.Factory) *cobra.Command {
Use: "list [flags]",
Short: `Get the list of CI pipelines`,
Example: heredoc.Doc(`
$ glab ci list
$ glab ci list --status=failed
glab ci list
glab ci list --status=failed
`),
Long: ``,
Args: cobra.ExactArgs(0),

View File

@ -17,7 +17,7 @@ func NewCmdRetry(f *cmdutils.Factory) *cobra.Command {
Short: `Retry a CI job`,
Aliases: []string{},
Example: heredoc.Doc(`
$ glab ci retry 871528
glab ci retry 871528
`),
Long: ``,
Args: cobra.ExactArgs(1),

View File

@ -45,10 +45,10 @@ func NewCmdRun(f *cmdutils.Factory) *cobra.Command {
Short: `Create or run a new CI pipeline`,
Aliases: []string{"create"},
Example: heredoc.Doc(`
$ glab ci run
$ glab ci run -b main
$ glab ci run -b main --variables MYKEY:some_value
$ glab ci run -b main --variables MYKEY:some_value --variables KEY2:another_value
glab ci run
glab ci run -b main
glab ci run -b main --variables MYKEY:some_value
glab ci run -b main --variables MYKEY:some_value --variables KEY2:another_value
`),
Long: ``,
Args: cobra.ExactArgs(0),

View File

@ -22,10 +22,10 @@ func NewCmdStatus(f *cmdutils.Factory) *cobra.Command {
Short: `View a running CI pipeline on current or other branch specified`,
Aliases: []string{"stats"},
Example: heredoc.Doc(`
$ glab ci status --live
$ glab ci status --compact // more compact view
$ glab ci status --branch=master // Get pipeline for master branch
$ glab ci status // Get pipeline for current branch
glab ci status --live
glab ci status --compact // more compact view
glab ci status --branch=master // Get pipeline for master branch
glab ci status // Get pipeline for current branch
`),
Long: ``,
Args: cobra.ExactArgs(0),

View File

@ -50,13 +50,13 @@ func NewCmdView(f *cmdutils.Factory) *cobra.Command {
'Ctrl+C' to cancel job -- (Quits CI view if selected job isn't running or pending).
'Ctrl+Q' to Quit CI View.
'Ctrl+Space' suspend application and view logs (similar to glab pipeline ci trace)
Supports vi style (hjkl,Gg) bindings and arrow keys for navigating jobs and logs.
Supports vi style bindings and arrow keys for navigating jobs and logs.
`),
Example: heredoc.Doc(`
$ glab pipeline ci view # Uses current branch
$ glab pipeline ci view master # Get latest pipeline on master branch
$ glab pipeline ci view -b master # just like the second example
$ glab pipeline ci view -b master -R profclems/glab # Get latest pipeline on master branch of profclems/glab repo
glab pipeline ci view # Uses current branch
glab pipeline ci view master # Get latest pipeline on master branch
glab pipeline ci view -b master # just like the second example
glab pipeline ci view -b master -R profclems/glab # Get latest pipeline on master branch of profclems/glab repo
`),
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -3,6 +3,7 @@ package completion
import (
"fmt"
"github.com/MakeNowJust/heredoc"
"gitlab.com/gitlab-org/cli/pkg/iostreams"
"github.com/spf13/cobra"
@ -19,27 +20,33 @@ func NewCmdCompletion(io *iostreams.IOStreams) *cobra.Command {
var completionCmd = &cobra.Command{
Use: "completion",
Short: "Generate shell completion scripts",
Long: `Generate shell completion scripts for glab commands.
Long: heredoc.Docf(`
The output of this command will be computer code and is meant to be saved
to a file or immediately evaluated by an interactive shell.
For example, for bash you could add this to your %[1]s~/.bash_profile%[1]s:
%[2]splaintext
eval "$(glab completion -s bash)"
%[2]s
The output of this command will be computer code and is meant to be saved to a
file or immediately evaluated by an interactive shell.
Generate a %[1]s_glab%[1]s completion script and put it somewhere in your %[1]s$fpath%[1]s:
For example, for bash you could add this to your '~/.bash_profile':
%[2]splaintext
glab completion -s zsh > /usr/local/share/zsh/site-functions/_glab
%[2]s
eval "$(glab completion -s bash)"
Ensure that the following is present in your %[1]s~/.zshrc%[1]s:
Generate a %[1]s_glab%[1]s completion script and put it somewhere in your %[1]s$fpath%[1]s:
glab completion -s zsh > /usr/local/share/zsh/site-functions/_glab
Ensure that the following is present in your %[1]s~/.zshrc%[1]s:
autoload -U compinit
compinit -i
Zsh version 5.7 or later is recommended.
- %[1]sautoload -U compinit%[1]s
- %[1]scompinit -i%[1]s
When installing glab through a package manager, however, it's possible that
no additional shell configuration is necessary to gain completion support.
For Homebrew, see <https://docs.brew.sh/Shell-Completion>
`,
Zsh version 5.7 or later is recommended.
When installing glab through a package manager, however, it's possible that
no additional shell configuration is necessary to gain completion support.
For Homebrew, see <https://docs.brew.sh/Shell-Completion>
`, "`", "```"),
RunE: func(cmd *cobra.Command, args []string) error {
out := io.StdOut
rootCmd := cmd.Parent()

View File

@ -17,18 +17,18 @@ func NewCmdConfig(f *cmdutils.Factory) *cobra.Command {
configCmd := &cobra.Command{
Use: "config [flags]",
Short: `Set and get glab settings`,
Long: heredoc.Doc(`Get and set key/value strings.
Long: heredoc.Docf(`Get and set key/value strings.
Current respected settings:
- token: Your gitlab access token, defaults to environment variables
- gitlab_uri: if unset, defaults to https://gitlab.com
- token: Your GitLab access token, defaults to environment variables
- gitlab_uri: if unset, defaults to %[1]shttps://gitlab.com%[1]s
- browser: if unset, defaults to environment variables
- editor: if unset, defaults to environment variables.
- visual: alternative for editor. if unset, defaults to environment variables.
- glamour_style: Your desired markdown renderer style. Options are dark, light, notty. Custom styles are allowed set a custom style https://github.com/charmbracelet/glamour#styles
- glamour_style: Your desired Markdown renderer style. Options are dark, light, notty. Custom styles are allowed using [glamour](https://github.com/charmbracelet/glamour#styles)
- glab_pager: Your desired pager command to use (e.g. less -R)
`),
`, "`"),
Aliases: []string{"conf"},
}
@ -49,8 +49,8 @@ func NewCmdConfigGet(f *cmdutils.Factory) *cobra.Command {
cmd := &cobra.Command{
Use: "get <key>",
Short: "Prints the value of a given configuration key",
Long: `Get the value for a given configuration key.`,
Short: "Prints the value of a given configuration key.",
Long: ``,
Example: `
$ glab config get editor
vim
@ -93,8 +93,8 @@ Use glab config set --global if you want to set a global config.
Specifying the --hostname flag also saves in the global config file
`,
Example: `
$ glab config set editor vim
$ glab config set token xxxxx -h gitlab.com
glab config set editor vim
glab config set token xxxxx -h gitlab.com
`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
@ -138,11 +138,16 @@ func NewCmdConfigInit(f *cmdutils.Factory) *cobra.Command {
configInitCmd := &cobra.Command{
Use: "init",
Short: "Shows a prompt to set basic glab configuration",
Long: `Update the configuration by setting a key to a value.
Examples:
$ glab config init
? Enter default Gitlab Host (Current Value: https://gitlab.com): |
`,
Long: heredoc.Docf(`
Update the configuration by setting a key to a value.
Examples:
%[1]splaintext
$ glab config init
? Enter default GitLab Host (Current Value: https://gitlab.com):
%[1]s
`,"```"),
RunE: func(cmd *cobra.Command, args []string) error {
return configInit(f)
},

View File

@ -18,8 +18,8 @@ func NewCmdClose(f *cmdutils.Factory) *cobra.Command {
Short: `Close an issue`,
Long: ``,
Example: heredoc.Doc(`
$ glab issue close 123
$ glab issue close https://gitlab.com/profclems/glab/-/issues/123
glab issue close 123
glab issue close https://gitlab.com/profclems/glab/-/issues/123
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -67,11 +67,11 @@ func NewCmdCreate(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"new"},
Example: heredoc.Doc(`
$ glab issue create
$ glab issue new
$ glab issue create -m release-2.0.0 -t "we need this feature" --label important
$ glab issue new -t "Fix CVE-YYYY-XXXX" -l security --linked-mr 123
$ glab issue create -m release-1.0.1 -t "security fix" --label security --web
glab issue create
glab issue new
glab issue create -m release-2.0.0 -t "we need this feature" --label important
glab issue new -t "Fix CVE-YYYY-XXXX" -l security --linked-mr 123
glab issue create -m release-1.0.1 -t "security fix" --label security --web
`),
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -18,9 +18,9 @@ func NewCmdDelete(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"del"},
Example: heredoc.Doc(`
$ glab issue delete 123
$ glab issue del 123
$ glab issue delete https://gitlab.com/profclems/glab/-/issues/123
glab issue delete 123
glab issue del 123
glab issue delete https://gitlab.com/profclems/glab/-/issues/123
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -24,10 +24,10 @@ func NewCmdIssue(f *cmdutils.Factory) *cobra.Command {
Short: `Work with GitLab issues`,
Long: ``,
Example: heredoc.Doc(`
$ glab issue list
$ glab issue create --label --confidential
$ glab issue view --web
$ glab issue note -m "closing because !123 was merged" <issue number>
glab issue list
glab issue create --label --confidential
glab issue view --web
glab issue note -m "closing because !123 was merged" <issue number>
`),
Annotations: map[string]string{
"help:arguments": heredoc.Doc(`

View File

@ -65,10 +65,10 @@ func NewCmdList(f *cmdutils.Factory, runE func(opts *ListOptions) error) *cobra.
Long: ``,
Aliases: []string{"ls"},
Example: heredoc.Doc(`
$ glab issue list --all
$ glab issue ls --all
$ glab issue list --mine
$ glab issue list --milestone release-2.0.0 --opened
glab issue list --all
glab issue ls --all
glab issue list --mine
glab issue list --milestone release-2.0.0 --opened
`),
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -19,9 +19,9 @@ func NewCmdReopen(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"open"},
Example: heredoc.Doc(`
$ glab issue reopen 123
$ glab issue open 123
$ glab issue reopen https://gitlab.com/profclems/glab/-/issues/123
glab issue reopen 123
glab issue open 123
glab issue reopen https://gitlab.com/profclems/glab/-/issues/123
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -17,9 +17,9 @@ func NewCmdSubscribe(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"sub"},
Example: heredoc.Doc(`
$ glab issue subscribe 123
$ glab issue sub 123
$ glab issue subscribe https://gitlab.com/profclems/glab/-/issues/123
glab issue subscribe 123
glab issue sub 123
glab issue subscribe https://gitlab.com/profclems/glab/-/issues/123
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -18,9 +18,9 @@ func NewCmdUnsubscribe(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"unsub"},
Example: heredoc.Doc(`
$ glab issue unsubscribe 123
$ glab issue unsub 123
$ glab issue unsubscribe https://gitlab.com/profclems/glab/-/issues/123
glab issue unsubscribe 123
glab issue unsub 123
glab issue unsubscribe https://gitlab.com/profclems/glab/-/issues/123
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -20,8 +20,8 @@ func NewCmdUpdate(f *cmdutils.Factory) *cobra.Command {
Short: `Update issue`,
Long: ``,
Example: heredoc.Doc(`
$ glab issue update 42 --label ui,ux
$ glab issue update 42 --unlabel working
glab issue update 42 --label ui,ux
glab issue update 42 --unlabel working
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -42,11 +42,11 @@ func NewCmdView(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"show"},
Example: heredoc.Doc(`
$ glab issue view 123
$ glab issue show 123
$ glab issue view --web 123
$ glab issue view --comments 123
$ glab issue view https://gitlab.com/profclems/glab/-/issues/123
glab issue view 123
glab issue show 123
glab issue view --web 123
glab issue view --comments 123
glab issue view https://gitlab.com/profclems/glab/-/issues/123
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -18,9 +18,9 @@ func NewCmdCreate(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"new"},
Example: heredoc.Doc(`
$ glab label create
$ glab label new
$ glab label create -R owner/repo
glab label create
glab label new
glab label create -R owner/repo
`),
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -20,9 +20,9 @@ func NewCmdList(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"ls"},
Example: heredoc.Doc(`
$ glab label list
$ glab label ls
$ glab label list -R owner/repository
glab label list
glab label ls
glab label list -R owner/repository
`),
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -17,11 +17,11 @@ func NewCmdApprove(f *cmdutils.Factory) *cobra.Command {
Short: `Approve merge requests`,
Long: ``,
Example: heredoc.Doc(`
$ glab mr approve 235
$ glab mr approve 123 345
$ glab mr approve branch-1
$ glab mr approve branch-2 branch-3
$ glab mr approve # Finds open merge request from current branch
glab mr approve 235
glab mr approve 123 345
glab mr approve branch-1
glab mr approve branch-2 branch-3
glab mr approve # Finds open merge request from current branch
`),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

View File

@ -29,11 +29,11 @@ func NewCmdCheckout(f *cmdutils.Factory) *cobra.Command {
Short: "Checkout to an open merge request",
Long: ``,
Example: heredoc.Doc(`
$ glab mr checkout 1
$ glab mr checkout branch --track
$ glab mr checkout 12 --branch todo-fix
$ glab mr checkout new-feature --set-upstream-to=upstream/main
$ glab mr checkout # use checked out branch
glab mr checkout 1
glab mr checkout branch --track
glab mr checkout 12 --branch todo-fix
glab mr checkout new-feature --set-upstream-to=upstream/main
glab mr checkout # use checked out branch
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -18,12 +18,12 @@ func NewCmdClose(f *cmdutils.Factory) *cobra.Command {
Short: `Close merge requests`,
Long: ``,
Example: heredoc.Doc(`
$ glab mr close 1
$ glab mr close 1 2 3 4 # close multiple branches at once
$ glab mr close # use checked out branch
$ glab mr close branch
$ glab mr close username:branch
$ glab mr close branch -R another/repo
glab mr close 1
glab mr close 1 2 3 4 # close multiple branches at once
glab mr close # use checked out branch
glab mr close branch
glab mr close username:branch
glab mr close branch -R another/repo
`),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

View File

@ -89,11 +89,11 @@ func NewCmdCreate(f *cmdutils.Factory, runE func(opts *CreateOpts) error) *cobra
Long: ``,
Aliases: []string{"new"},
Example: heredoc.Doc(`
$ glab mr new
$ glab mr create -a username -t "fix annoying bug"
$ glab mr create -f --draft --label RFC
$ glab mr create --fill --yes --web
$ glab mr create --fill --fill-commit-body --yes
glab mr new
glab mr create -a username -t "fix annoying bug"
glab mr create -f --draft --label RFC
glab mr create --fill --yes --web
glab mr create --fill --fill-commit-body --yes
`),
Args: cobra.ExactArgs(0),
PreRun: func(cmd *cobra.Command, args []string) {

View File

@ -18,11 +18,11 @@ func NewCmdDelete(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"del"},
Example: heredoc.Doc(`
$ glab mr delete 123
$ glab mr delete 123 branch-name 789 # close multiple branches
$ glab mr delete 1,2,branch-related-to-mr-3,4,5 # close MRs !1,!2,!3,!4,!5
$ glab mr del 123
$ glab mr delete branch
glab mr delete 123
glab mr delete 123 branch-name 789 # close multiple branches
glab mr delete 1,2,branch-related-to-mr-3,4,5 # close MRs !1,!2,!3,!4,!5
glab mr del 123
glab mr delete branch
`),
RunE: func(cmd *cobra.Command, args []string) error {
c := f.IO.Color()

View File

@ -39,10 +39,10 @@ func NewCmdDiff(f *cmdutils.Factory, runF func(*DiffOptions) error) *cobra.Comma
Use: "diff [<id> | <branch>]",
Short: "View changes in a merge request",
Example: heredoc.Doc(`
$ glab mr diff 123
$ glab mr diff branch
$ glab mr diff # get from current branch
$ glab mr diff 123 --color=never
glab mr diff 123
glab mr diff branch
glab mr diff # get from current branch
glab mr diff 123 --color=never
`),
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -23,10 +23,10 @@ func NewCmdFor(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"new-for", "create-for", "for-issue"},
Example: heredoc.Doc(`
$ glab mr for 34 # Create mr for issue 34
$ glab mr for 34 --wip # Create mr and mark as work in progress
$ glab mr new-for 34
$ glab mr create-for 34
glab mr for 34 # Create mr for issue 34
glab mr for 34 --wip # Create mr and mark as work in progress
glab mr new-for 34
glab mr create-for 34
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -22,9 +22,9 @@ func NewCmdIssues(f *cmdutils.Factory) *cobra.Command {
Aliases: []string{"issue"},
Args: cobra.MaximumNArgs(1),
Example: heredoc.Doc(`
$ glab mr issues 46
$ glab mr issues branch
$ glab mr issues # use checked out branch
glab mr issues 46
glab mr issues branch
glab mr issues # use checked out branch
`),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

View File

@ -63,16 +63,16 @@ func NewCmdList(f *cmdutils.Factory, runE func(opts *ListOptions) error) *cobra.
Long: ``,
Aliases: []string{"ls"},
Example: heredoc.Doc(`
$ glab mr list --all
$ glab mr ls -a
$ glab mr list --assignee=@me
$ glab mr list --reviewer=@me
$ glab mr list --source-branch=new-feature
$ glab mr list --target-branch=main
$ glab mr list --search "this adds feature X"
$ glab mr list --label needs-review
$ glab mr list --not-label waiting-maintainer-feedback,subsystem-x
$ glab mr list -M --per-page 10
glab mr list --all
glab mr ls -a
glab mr list --assignee=@me
glab mr list --reviewer=@me
glab mr list --source-branch=new-feature
glab mr list --target-branch=main
glab mr list --search "this adds feature X"
glab mr list --label needs-review
glab mr list --not-label waiting-maintainer-feedback,subsystem-x
glab mr list -M --per-page 10
`),
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -52,9 +52,9 @@ func NewCmdMerge(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"accept"},
Example: heredoc.Doc(`
$ glab mr merge 235
$ glab mr accept 235
$ glab mr merge # Finds open merge request from current branch
glab mr merge 235
glab mr accept 235
glab mr merge # Finds open merge request from current branch
`),
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -33,9 +33,9 @@ func NewCmdMR(f *cmdutils.Factory) *cobra.Command {
Short: `Create, view and manage merge requests`,
Long: ``,
Example: heredoc.Doc(`
$ glab mr create --fill --label bugfix
$ glab mr merge 123
$ glab mr note -m "needs to do X before it can be merged" branch-foo
glab mr create --fill --label bugfix
glab mr merge 123
glab mr note -m "needs to do X before it can be merged" branch-foo
`),
Annotations: map[string]string{
"help:arguments": heredoc.Doc(`

View File

@ -12,11 +12,12 @@ func NewCmdRebase(f *cmdutils.Factory) *cobra.Command {
var mrRebaseCmd = &cobra.Command{
Use: "rebase [<id> | <branch>] [flags]",
Short: `Automatically rebase the source_branch of the merge request against its target_branch.`,
Long: `If you dont have permissions to push to the merge requests source branch - youll get a 403 Forbidden response.`,
Long: heredoc.Doc(`If you don't have permissions to push to the merge request's source branch - you'll get a 403 Forbidden response.
`),
Example: heredoc.Doc(`
$ glab mr rebase 123
$ glab mr rebase # get from current branch
$ glab mr rebase branch
glab mr rebase 123
glab mr rebase # get from current branch
glab mr rebase branch
`),
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -17,10 +17,10 @@ func NewCmdReopen(f *cmdutils.Factory) *cobra.Command {
Use: "reopen [<id>... | <branch>...]",
Short: `Reopen merge requests`,
Example: heredoc.Doc(`
$ glab mr reopen 123
$ glab mr reopen 123 456 789
$ glab mr reopen branch-1 branch-2
$ glab mr reopen # use checked out branch
glab mr reopen 123
glab mr reopen 123 456 789
glab mr reopen branch-1 branch-2
glab mr reopen # use checked out branch
`),
Aliases: []string{"open"},
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -14,15 +14,15 @@ import (
func NewCmdRevoke(f *cmdutils.Factory) *cobra.Command {
var mrRevokeCmd = &cobra.Command{
Use: "revoke [<id> | <branch>]",
Short: `Revoke approval on a merge request <id>`,
Short: `Revoke approval on a merge request`,
Long: ``,
Aliases: []string{"unapprove"},
Example: heredoc.Doc(`
$ glab mr revoke 123
$ glab mr unapprove 123
$ glab mr revoke branch
$ glab mr revoke # use checked out branch
$ glab mr revoke 123 branch 456
glab mr revoke 123
glab mr unapprove 123
glab mr revoke branch
glab mr revoke # use checked out branch
glab mr revoke 123 branch 456
`),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

View File

@ -18,10 +18,10 @@ func NewCmdSubscribe(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"sub"},
Example: heredoc.Doc(`
$ glab mr subscribe 123
$ glab mr sub 123
$ glab mr subscribe branch
$ glab mr subscribe 123 branch # subscribe to multiple MRs
glab mr subscribe 123
glab mr sub 123
glab mr subscribe branch
glab mr subscribe 123 branch # subscribe to multiple MRs
`),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

View File

@ -18,10 +18,10 @@ func NewCmdUnsubscribe(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"unsub"},
Example: heredoc.Doc(`
$ glab mr unsubscribe 123
$ glab mr unsub 123
$ glab mr unsubscribe branch
$ glab mr unsubscribe 123 branch # unsubscribe from multiple MRs
glab mr unsubscribe 123
glab mr unsub 123
glab mr unsubscribe branch
glab mr unsubscribe 123 branch # unsubscribe from multiple MRs
`),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

View File

@ -20,9 +20,9 @@ func NewCmdUpdate(f *cmdutils.Factory) *cobra.Command {
Short: `Update merge requests`,
Long: ``,
Example: heredoc.Doc(`
$ glab mr update 23 --ready
$ glab mr update 23 --draft
$ glab mr update --draft # Updates MR related to current branch
glab mr update 23 --ready
glab mr update 23 --draft
glab mr update --draft # Updates MR related to current branch
`),
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -20,13 +20,14 @@ func NewCmdArchive(f *cmdutils.Factory) *cobra.Command {
Use: "archive <command> [flags]",
Short: `Get an archive of the repository.`,
Example: heredoc.Doc(`
$ glab repo archive profclems/glab
$ glab repo archive # Downloads zip file of current repository
$ glab repo archive profclems/glab mydirectory # Downloads repo zip file into mydirectory
$ glab repo archive profclems/glab --format=zip # Finds repo for current user and download in zip format
glab repo archive profclems/glab
glab repo archive # Downloads zip file of current repository
glab repo archive profclems/glab mydirectory # Downloads repo zip file into mydirectory
glab repo archive profclems/glab --format=zip # Finds repo for current user and download in zip format
`),
Long: heredoc.Doc(`
Clone supports these shorthands
- repo
- namespace/repo
- namespace/group/repo

View File

@ -62,7 +62,7 @@ func NewCmdClone(f *cmdutils.Factory, runE func(*CloneOptions, *ContextOpts) err
var repoCloneCmd = &cobra.Command{
Use: "clone <repo> [<dir>] [-- [<gitflags>...]]",
Short: `Clone a Gitlab repository/project`,
Short: `Clone a GitLab repository/project`,
Example: heredoc.Doc(`
$ glab repo clone profclems/glab
@ -81,13 +81,12 @@ func NewCmdClone(f *cmdutils.Factory, runE func(*CloneOptions, *ContextOpts) err
$ GITLAB_HOST=salsa.debian.org glab repo clone myrepo
`),
Long: heredoc.Doc(`
Clone a GitLab repository/project
Clone supports these shorthands
- repo
- namespace/repo
- org/group/repo
- project ID
Clone supports these shorthands
- repo
- namespace/repo
- org/group/repo
- project ID
`),
RunE: func(cmd *cobra.Command, args []string) error {
if nArgs := len(args); nArgs > 0 {

View File

@ -23,8 +23,8 @@ import (
func NewCmdCreate(f *cmdutils.Factory) *cobra.Command {
var projectCreateCmd = &cobra.Command{
Use: "create [path] [flags]",
Short: `Create a new GitLab project/repository`,
Long: `Create a new GitLab repository.`,
Short: `Create a new GitLab project/repository.`,
Long: ``,
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runCreateProject(cmd, args, f)

View File

@ -34,8 +34,8 @@ func NewCmdDelete(f *cmdutils.Factory) *cobra.Command {
var projectCreateCmd = &cobra.Command{
Use: "delete [<NAMESPACE>/]<NAME>",
Short: `Delete an existing repository on GitLab`,
Long: `Delete an existing repository on GitLab`,
Short: `Delete an existing repository on GitLab.`,
Long: ``,
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.Args = args

View File

@ -55,9 +55,9 @@ func NewCmdFork(f *cmdutils.Factory, runE func(*cmdutils.Factory) error) *cobra.
Use: "fork <repo>",
Short: "Create a fork of a GitLab repository",
Example: heredoc.Doc(`
$ glab repo fork
$ glab repo fork namespace/repo
$ glab repo fork namespace/repo --clone
glab repo fork
glab repo fork namespace/repo
glab repo fork namespace/repo --clone
`),
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {

View File

@ -36,7 +36,7 @@ func NewCmdList(f *cmdutils.Factory) *cobra.Command {
Use: "list",
Short: `Get list of repositories.`,
Example: heredoc.Doc(`
$ glab repo list
glab repo list
`),
Args: cobra.ExactArgs(0),
Aliases: []string{"users"},

View File

@ -34,8 +34,8 @@ func NewCmdMirror(f *cmdutils.Factory) *cobra.Command {
var projectMirrorCmd = &cobra.Command{
Use: "mirror [ID | URL | PATH] [flags]",
Short: "Mirror a project/repository",
Long: `Mirrors a project/repository to the specified location using pull or push method.`,
Short: "Mirror a project/repository to the specified location using pull or push method.",
Long: ``,
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

View File

@ -21,10 +21,10 @@ func NewCmdSearch(f *cmdutils.Factory) *cobra.Command {
Args: cobra.ExactArgs(0),
Aliases: []string{"find", "lookup"},
Example: heredoc.Doc(`
$ glab project search title
$ glab repo search title
$ glab project find title
$ glab project lookup title
glab project search title
glab repo search title
glab project find title
glab project lookup title
`),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

View File

@ -14,7 +14,7 @@ func NewCmdTransfer(f *cmdutils.Factory) *cobra.Command {
Use: "transfer [repo] [flags]",
Short: `Transfer a repository to a new namespace.`,
Example: heredoc.Doc(`
$ glab repo transfer profclems/glab --target-namespace notprofclems
glab repo transfer profclems/glab --target-namespace notprofclems
`),
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -35,7 +35,8 @@ func NewCmdView(f *cmdutils.Factory) *cobra.Command {
var projectViewCmd = &cobra.Command{
Use: "view [repository] [flags]",
Short: "View a project/repository",
Long: `Display the description and README of a project or open it in the browser.`,
Long: heredoc.Doc(`Display the description and README of a project or open it in the browser.
`),
Args: cobra.MaximumNArgs(1),
Example: heredoc.Doc(`
# view project information for the current directory

View File

@ -65,16 +65,16 @@ func NewCmdCreate(f *cmdutils.Factory, runE func(opts *CreateOpts) error) *cobra
If the release already exists, glab updates the release with the new info provided.
If a git tag specified does not yet exist, the release will automatically get created
If a Git tag specified does not yet exist, the release will automatically get created
from the latest state of the default branch and tagged with the specified tag name.
Use %[1]s--ref%[1]s to override this.
The %[1]sref%[1]s can be a commit SHA, another tag name, or a branch name.
To fetch the new tag locally after the release, do %[1]sgit fetch --tags origin%[1]s.
To create a release from an annotated git tag, first create one locally with
git, push the tag to GitLab, then run this command.
To create a release from an annotated Git tag, first create one locally with
Git, push the tag to GitLab, then run this command.
NB: Developer level access to the project is required to create a release.
Developer level access to the project is required to create a release.
`, "`"),
Args: cmdutils.MinimumArgs(1, "no tag name provided"),
Example: heredoc.Doc(`
@ -101,14 +101,14 @@ func NewCmdCreate(f *cmdutils.Factory, runE func(opts *CreateOpts) error) *cobra
Create a release with assets specified as JSON object
$ glab release create v1.0.1 --assets-links='
[
{
"name": "Asset1",
"url":"https://<domain>/some/location/1",
"link_type": "other",
"filepath": "path/to/file"
}
]'
[
{
"name": "Asset1",
"url":"https://<domain>/some/location/1",
"link_type": "other",
"filepath": "path/to/file"
}
]'
`),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

View File

@ -36,7 +36,7 @@ func NewCmdDelete(f *cmdutils.Factory, runE func(opts *DeleteOpts) error) *cobra
cmd := &cobra.Command{
Use: "delete <tag>",
Short: "Delete a GitLab Release",
Short: "Delete a GitLab Release",
Long: heredoc.Docf(`Delete release assets to GitLab Release
Deleting a release does not delete the associated tag unless %[1]s--with-tag%[1]s is specified.

View File

@ -70,14 +70,14 @@ func NewCmdUpload(f *cmdutils.Factory, runE func(opts *UploadOpts) error) *cobra
Upload release assets links specified as JSON string
$ glab release upload v1.0.1 --assets-links='
[
{
"name": "Asset1",
"url":"https://<domain>/some/location/1",
"link_type": "other",
"filepath": "path/to/file"
}
]'
[
{
"name": "Asset1",
"url":"https://<domain>/some/location/1",
"link_type": "other",
"filepath": "path/to/file"
}
]'
`),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

View File

@ -35,10 +35,10 @@ func NewCmdView(f *cmdutils.Factory, runE func(opts *ViewOpts) error) *cobra.Com
cmd := &cobra.Command{
Use: "view <tag>",
Short: "View information about a GitLab Release",
Long: heredoc.Docf(`View information about a GitLab Release.
Long: heredoc.Doc(`View information about a GitLab Release.
Without an explicit tag name argument, the latest release in the project is shown.
`, "`"),
`,),
Example: heredoc.Doc(`
View the latest release of a GitLab repository
$ glab release view

View File

@ -41,9 +41,9 @@ func NewCmdCreate(f *cmdutils.Factory) *cobra.Command {
Long: ``,
Aliases: []string{"new"},
Example: heredoc.Doc(`
$ glab snippet create script.py --title "Title of the snippet"
$ echo "package main" | glab snippet new --title "Title of the snippet" --filename "main.go"
$ glab snippet create main.go -t Title -f "different.go" -d Description
glab snippet create script.py --title "Title of the snippet"
echo "package main" | glab snippet new --title "Title of the snippet" --filename "main.go"
glab snippet create main.go -t Title -f "different.go" -d Description
`),
PreRunE: func(cmd *cobra.Command, args []string) error {
opts.IO = f.IO

View File

@ -13,7 +13,7 @@ func NewCmdSnippet(f *cmdutils.Factory) *cobra.Command {
Short: `Create, view and manage snippets`,
Long: ``,
Example: heredoc.Doc(`
$ glab snippet create --title "Title of the snippet" --filename "main.go"
glab snippet create --title "Title of the snippet" --filename "main.go"
`),
Annotations: map[string]string{
"help:arguments": heredoc.Doc(`

View File

@ -28,8 +28,8 @@ func NewCmdGet(f *cmdutils.Factory, runE func(*GetOpts) error) *cobra.Command {
}
cmd := &cobra.Command{
Use: "get <key-id>",
Short: "Gets a single key",
Long: "Returns a single SSH key specified by the ID",
Short: "Returns a single SSH key specified by the ID.",
Long: ``,
Example: heredoc.Doc(`
# Get ssh key with ID as argument
$ glab ssh-key get 7750633

View File

@ -25,10 +25,10 @@ func NewCmdList(f *cmdutils.Factory, runE func(*ListOpts) error) *cobra.Command
}
cmd := &cobra.Command{
Use: "list",
Short: "Lists currently authenticated users SSH keys",
Long: "Get a list of currently authenticated users SSH keys",
Short: "Get a list of currently authenticated user's SSH keys.",
Long: "",
Example: heredoc.Doc(`
$ glab ssh-key list
glab ssh-key list
`),
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -11,8 +11,8 @@ import (
func NewCmdSSHKey(f *cmdutils.Factory) *cobra.Command {
cmd := &cobra.Command{
Use: "ssh-key <command>",
Short: "Manage SSH keys",
Long: "Manage SSH keys registered with your GitLab account",
Short: "Manage SSH keys registered with your GitLab account.",
Long: "",
}
cmdutils.EnableRepoOverride(cmd, f)

View File

@ -37,9 +37,9 @@ func NewCmdSet(f *cmdutils.Factory, runE func(opts *DeleteOpts) error) *cobra.Co
Aliases: []string{"remove"},
Args: cobra.ExactArgs(1),
Example: heredoc.Doc(`
$ glab variable delete VAR_NAME
$ glab variable delete VAR_NAME --scope=prod
$ glab variable delete VARNAME -g mygroup
glab variable delete VAR_NAME
glab variable delete VAR_NAME --scope=prod
glab variable delete VARNAME -g mygroup
`),
RunE: func(cmd *cobra.Command, args []string) (err error) {
opts.HTTPClient = f.HttpClient

View File

@ -32,8 +32,8 @@ func NewCmdSet(f *cmdutils.Factory, runE func(opts *GetOps) error) *cobra.Comman
Short: "get a project or group variable",
Args: cobra.RangeArgs(1, 1),
Example: heredoc.Doc(`
$ glab variable get VAR_KEY
$ glab variable get -g GROUP VAR_KEY
glab variable get VAR_KEY
glab variable get -g GROUP VAR_KEY
`),
RunE: func(cmd *cobra.Command, args []string) (err error) {

View File

@ -31,7 +31,7 @@ func NewCmdSet(f *cmdutils.Factory, runE func(opts *ListOpts) error) *cobra.Comm
Aliases: []string{"new", "create"},
Args: cobra.ExactArgs(0),
Example: heredoc.Doc(`
$ glab variable list
glab variable list
`),
RunE: func(cmd *cobra.Command, args []string) (err error) {
// Supports repo override

View File

@ -40,13 +40,13 @@ func NewCmdSet(f *cmdutils.Factory, runE func(opts *SetOpts) error) *cobra.Comma
Aliases: []string{"new", "create"},
Args: cobra.RangeArgs(1, 2),
Example: heredoc.Doc(`
$ glab variable set WITH_ARG "some value"
$ glab variable set FROM_FLAG -v "some value"
$ glab variable set FROM_ENV_WITH_ARG "${ENV_VAR}"
$ glab variable set FROM_ENV_WITH_FLAG -v"${ENV_VAR}"
$ glab variable set FROM_FILE < secret.txt
$ cat file.txt | glab variable set SERVER_TOKEN
$ cat token.txt | glab variable set GROUP_TOKEN -g mygroup --scope=prod
glab variable set WITH_ARG "some value"
glab variable set FROM_FLAG -v "some value"
glab variable set FROM_ENV_WITH_ARG "${ENV_VAR}"
glab variable set FROM_ENV_WITH_FLAG -v"${ENV_VAR}"
glab variable set FROM_FILE < secret.txt
cat file.txt | glab variable set SERVER_TOKEN
cat token.txt | glab variable set GROUP_TOKEN -g mygroup --scope=prod
`),
RunE: func(cmd *cobra.Command, args []string) (err error) {
// Supports repo override

View File

@ -39,13 +39,13 @@ func NewCmdSet(f *cmdutils.Factory, runE func(opts *UpdateOpts) error) *cobra.Co
Short: "Update an existing project or group variable",
Args: cobra.RangeArgs(1, 2),
Example: heredoc.Doc(`
$ glab variable update WITH_ARG "some value"
$ glab variable update FROM_FLAG -v "some value"
$ glab variable update FROM_ENV_WITH_ARG "${ENV_VAR}"
$ glab variable update FROM_ENV_WITH_FLAG -v"${ENV_VAR}"
$ glab variable update FROM_FILE < secret.txt
$ cat file.txt | glab variable update SERVER_TOKEN
$ cat token.txt | glab variable update GROUP_TOKEN -g mygroup --scope=prod
glab variable update WITH_ARG "some value"
glab variable update FROM_FLAG -v "some value"
glab variable update FROM_ENV_WITH_ARG "${ENV_VAR}"
glab variable update FROM_ENV_WITH_FLAG -v"${ENV_VAR}"
glab variable update FROM_FILE < secret.txt
cat file.txt | glab variable update SERVER_TOKEN
cat token.txt | glab variable update GROUP_TOKEN -g mygroup --scope=prod
`),
RunE: func(cmd *cobra.Command, args []string) (err error) {
// Supports repo override

View File

@ -0,0 +1,13 @@
---
# Suggestion: gitlab.Admin
#
# Checks for "admin" and recommends using the full word instead. "Admin Area" is OK.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: substitution
message: 'Verify this use of the word "admin". Can it be updated to "administration", "administrator", "administer", or "Admin Area"?'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html
level: suggestion
ignorecase: false
swap:
'[Aa]dmin ?\w*': '(?:Admin( Area| Mode)?|[Aa]dminist(ration|rator|rators|er|rative|ering|ered))'

View File

@ -0,0 +1,20 @@
---
# Error: gitlab.AlertBoxStyle
#
# Makes sure alert boxes are used with block quotes. Checks for 3 formatting issues:
#
# - Alert boxes inside a block quote (">")
# - Alert boxes with the note text on the same line
# - Alert boxes using words other than "NOTE" or "WARNING"
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Alert box "%s" must use the formatting in the style guide.'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#alert-boxes
level: error
nonword: true
scope: raw
raw:
- '(\n *\> *(?:NOTE|WARNING)|'
- '\n\n(NOTE|WARNING):[^\n]|'
- '\n\n *(?:> )?\**(Note|note|TIP|Tip|tip|CAUTION|Caution|caution|DANGER|Danger|danger|Warning|warning):.*)'

View File

@ -0,0 +1,13 @@
---
# Warning: gitlab.BadPlurals
#
# Don't write plural words with the '(s)' construction. "HTTP(S)" is acceptable.
#
# For a list of all options, see https://docs.errata.ai/vale/styles
extends: existence
message: 'Rewrite "%s" to be plural, without parentheses.'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/word_list.html#s
level: warning
ignorecase: true
raw:
- '\b\w+\(s\)(?<!http\(s\))'

View File

@ -0,0 +1,14 @@
---
# Error: gitlab.BadgeCapitalization
#
# Verifies that badges are not mixed case, which won't render properly.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Badge "%s" must be capitalized.'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#product-tier-badges
level: error
scope: raw
raw:
- '(?!\*\*\((FREE|PREMIUM|ULTIMATE)( (SELF|SAAS))?\)\*\*)'
- '(?i)\*\*\((free|premium|ultimate)( (self|saas))?\)\*\*'

View File

@ -0,0 +1,120 @@
---
# Error: gitlab.British
#
# Checks that US spelling is used instead of British spelling.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: substitution
message: 'Use the US spelling "%s" instead of the British "%s".'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#language
level: error
ignorecase: true
swap:
aeon: eon
aeroplane: airplane
ageing: aging
aluminium: aluminum
anaemia: anemia
anaesthesia: anesthesia
analyse: analyze
annexe: annex
apologise: apologize
authorise: authorize
authorised: authorized
authorisation: authorization
authorising: authorizing
behaviour: behavior
busses: buses
calibre: caliber
categorise: categorize
categorised: categorized
categorises: categorizes
categorising: categorizing
centre: center
cheque: check
civilisation: civilization
civilise: civilize
colour: color
cosy: cozy
cypher: cipher
dependant: dependent
defence: defense
distil: distill
draught: draft
encyclopaedia: encyclopedia
enquiry: inquiry
enrol: enroll
enrolment: enrollment
enthral: enthrall
# equalled: equaled // Under discussion
# equalling: equaling // Under discussion
favourite: favorite
fibre: fiber
fillet: filet
flavour: flavor
furore: furor
fulfil: fulfill
gaol: jail
grey: gray
humour: humor
honour: honor
initialled: initialed
initialling: initialing
instil: instill
jewellery: jewelry
labelling: labeling
labelled: labeled
labour: labor
libellous: libelous
licence: license
likeable: likable
liveable: livable
lustre: luster
manoeuvre: maneuver
marvellous: marvelous
matt: matte
meagre: meager
metre: meter
modelling: modeling
moustache: mustache
neighbour: neighbor
normalise: normalize
offence: offense
optimise: optimize
optimised: optimized
optimising: optimizing
organise: organize
orientated: oriented
paralyse: paralyze
plough: plow
pretence: pretense
programme: program
pyjamas: pajamas
rateable: ratable
realise: realize
recognise: recognize
reconnoitre: reconnoiter
rumour: rumor
sabre: saber
saleable: salable
saltpetre: saltpeter
sceptic: skeptic
sepulchre: sepulcher
signalling: signaling
sizeable: sizable
skilful: skillful
sombre: somber
smoulder: smolder
speciality: specialty
spectre: specter
splendour: splendor
standardise: standardize
standardised: standardized
sulphur: sulfur
theatre: theater
travelled: traveled
traveller: traveler
travelling: traveling
unshakeable: unshakable
wilful: willful
yoghurt: yogurt

View File

@ -0,0 +1,17 @@
---
# Error: gitlab.CIConfigFile
#
# Checks that the `.gitlab-ci.yml` file is referenced properly.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'The CI/CD configuration file should be exactly: `.gitlab-ci.yml`'
link: https://docs.gitlab.com/ee/development/documentation/versions.html
level: error
scope: raw
raw:
- '(`gitlab-ci.yml`|'
- '`gitlabci.yml`|'
- '`gitlab.ci.yml`|'
- '`.gitlab.ci-yml`|'
- '`.gitlab-ci.yaml`)'

View File

@ -0,0 +1,13 @@
---
# Error: gitlab.CodeblockFences
#
# Ensures all codeblock language tags use the full name, not aliases.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Syntax highlighting hint "%s" must be one of: yaml, ruby, plaintext, markdown, javascript, shell, golang, python, dockerfile, or typescript.'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#code-blocks
level: error
scope: raw
raw:
- '\`\`\`(yml|rb|text|md|bash|sh\n|js\n|go\n|py\n|docker\n|ts)'

View File

@ -0,0 +1,13 @@
---
# Error: gitlab.CurlStringsQuoted
#
# Ensures all code blocks using `curl` wrap URL strings in quotation marks.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'For consistency across all cURL examples, always wrap the URL in double quotes ("): %s'
link: https://docs.gitlab.com/ee/development/documentation/restful_api_styleguide.html#curl-commands
level: error
scope: code
raw:
- 'curl [^"]+://.*'

View File

@ -0,0 +1,14 @@
---
# Suggestion: gitlab.CurrentStatus
#
# Checks for words that indicate a product or feature may change in the future.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Avoid words like "%s" when you write about future features. Our documentation is about the current state of the product.'
level: suggestion
ignorecase: true
link: https://docs.gitlab.com/ee/development/documentation/styleguide/#promising-features-in-future-versions
tokens:
- currently
- yet

View File

@ -0,0 +1,14 @@
---
# Warning: gitlab.DefaultBranch
#
# Do not refer to the default branch as the "master" branch, if possible.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Use "default branch" or `main` instead of `master`, when possible.'
level: warning
ignorecase: true
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html
scope: raw
raw:
- '\`master\`'

View File

@ -0,0 +1,14 @@
---
# Suggestion: gitlab.Dropdown
#
# Catches many ways the phrase 'dropdown list' can be fumbled.
#
# For a list of all options, see https://errata-ai.github.io/vale/styles/
extends: existence
message: 'Use "dropdown list".'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/word_list.html#dropdown-list
level: suggestion
ignorecase: true
tokens:
- drop-down( [\w]*)?
- dropdown(?! list)

View File

@ -0,0 +1,13 @@
---
# Warning: gitlab.EOLWhitespace
#
# Checks that there is no useless whitespace at the end of lines.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Lines should not end with whitespace characters.'
link: https://docs.gitlab.com/ee/development/documentation/versions.html
level: warning
scope: raw
raw:
- ' +\n'

View File

@ -0,0 +1,13 @@
---
# Suggestion: gitlab.ElementDescriptors
#
# Suggests the correct way to describe elements in a form.
#
# For a list of all options, see https://errata-ai.github.io/vale/styles/
extends: substitution
message: 'When describing elements, %s "%s".'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#language
level: suggestion
ignorecase: true
swap:
button: 'if possible, rewrite to remove'

View File

@ -0,0 +1,16 @@
---
# Warning: gitlab.FirstPerson
#
# Checks for use of first person pronouns.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: '"%s" is a first-person pronoun. Use second- or third-person pronouns (like we, you, us, one) instead.'
level: warning
ignorecase: true
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#usage-list
tokens:
- '\bI[ ,;:?!"]|\bI\x27.{1,2}'
- me
- myself
- mine

View File

@ -0,0 +1,16 @@
---
# Warning: gitlab.FutureTense
#
# Checks for use of future tense in sentences. Present tense is strongly preferred.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Avoid using future tense: "%s". Use present tense instead.'
ignorecase: true
level: warning
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#usage-list
raw:
- "(going to( |\n|[[:punct:]])[a-zA-Z]*|"
- "will( |\n|[[:punct:]])[a-zA-Z]*|"
- "won't( |\n|[[:punct:]])[a-zA-Z]*|"
- "[a-zA-Z]*'ll( |\n|[[:punct:]])[a-zA-Z]*)"

View File

@ -0,0 +1,18 @@
---
# Warning: gitlab.HeadingContent
#
# Checks for generic, unhelpful subheadings.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Rename the subheading "%s", or re-purpose the content elsewhere.'
level: warning
scope: heading
link: https://docs.gitlab.com/ee/development/documentation/styleguide/#headings-1
ignorecase: false
tokens:
- How it works
- Limitations
- Overview
- Use cases?
- Important notes?

View File

@ -0,0 +1,13 @@
---
# Warning: gitlab.HeadingDepth
#
# Checks that there are no headings greater than 3 levels
#
# For a list of all options, see https://vale.sh/docs/topics/styles/
extends: existence
message: 'The subheading "%s" is nested too deeply. Headings deeper than H5 suggest the section or page should be refactored.'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#headings-in-markdown
level: warning
scope: raw
raw:
- '(?<=\n)#{5,}\s.*'

View File

@ -0,0 +1,14 @@
---
# Suggestion: gitlab.InclusionAbleism
#
# Suggests alternatives for words that foster ableism.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: substitution
message: 'Use inclusive language. Consider "%s" instead of "%s".'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#inclusive-language
level: suggestion
ignorecase: true
swap:
sanity (?:check|test): check for completeness
dummy: placeholder, sample, fake

View File

@ -0,0 +1,16 @@
---
# Warning: gitlab.InclusionCultural
#
# Suggests alternatives for words that are culturally inappropriate.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: substitution
message: 'Use inclusive language. Consider "%s" instead of "%s".'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#inclusive-language
level: warning
ignorecase: true
swap:
blacklist(?:ed|ing|s)?: denylist
whitelist(?:ed|ing|s)?: allowlist
master: primary, main
slave: secondary

View File

@ -0,0 +1,18 @@
---
# Suggestion: gitlab.InclusionGender
#
# Suggests alternatives for words that are gender-specific.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: substitution
message: 'Use inclusive language. Consider "%s" instead of "%s".'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#inclusive-language
level: suggestion
ignorecase: true
swap:
mankind: humanity, people
manpower: GitLab team members
he: they
his: their
she: they
hers: their

View File

@ -0,0 +1,13 @@
---
# Error: gitlab.InternalLinkCase
#
# Checks that anchor fragments on internal links are in lower-case.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Links to subheadings in GitLab docs must be in lower-case: "%s"'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#links-to-internal-documentation
level: error
scope: raw
raw:
- '[^\`]\[[^\[\]]+\]\((https?:){0}[\w\/\.]*?#[^\s]*?[A-Z][^\) ]*\)[^\`]'

View File

@ -0,0 +1,13 @@
---
# Error: gitlab.InternalLinkExtension
#
# Checks that internal links have .md extenstion and not .html extension.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Link "%s" must link directly to a file and use the .md file extension.'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#links-to-internal-documentation
level: error
scope: raw
raw:
- '\[[^\]]+\]\([^:\)]+(\/(#[^\)]+)?\)|\.html(#.+)?\))'

View File

@ -0,0 +1,13 @@
---
# Error: gitlab.InternalLinkFormat
#
# Checks that internal link paths don't start with "./", which is not needed.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Link "%s" must not start with "./".'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#links-to-internal-documentation
level: error
scope: raw
raw:
- '\[.+\]\(\.\/.*?\)'

View File

@ -0,0 +1,17 @@
---
# Warning: gitlab.LatinTerms
#
# Checks for use of Latin terms.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: substitution
message: 'Use "%s" instead of "%s", but consider rewriting the sentence.'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#usage-list
level: warning
nonword: true
ignorecase: true
swap:
e\.g\.: for example
e\. g\.: for example
i\.e\.: that is
i\. e\.: that is

View File

@ -0,0 +1,13 @@
---
# Warning: gitlab.Markdown_emoji
#
# Check for use of GLFM emoji syntax (https://docs.gitlab.com/ee/user/markdown.html#emojis), which doesn't render correctly in documentation.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'This appears to be GLFM emoji syntax. Replace "%s" with GitLab SVGs or Unicode emojis.'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/#gitlab-svg-icons
level: warning
scope: text
raw:
- '(?:\s+|^):[a-zA-Z0-9\-_\+]+:(?:\s+|$|\.)'

View File

@ -0,0 +1,15 @@
---
# Warning: gitlab.MeaningfulLinkWords
#
# Checks for the presence of semantically unhelpful words in link text.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Improve SEO and accessibility by rewriting "%s" in the link text.'
level: warning
scope: link
ignorecase: true
link: https://about.gitlab.com/handbook/communication/#writing-style-guidelines
tokens:
- here
- this page

View File

@ -0,0 +1,13 @@
---
# Error: gitlab.MergeConflictMarkers
#
# Checks for the presence of merge conflict markers.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'Merge conflict marker "%s" found.'
link: https://docs.gitlab.com/ee/development/code_review.html#merging-a-merge-request
level: error
scope: raw
raw:
- '\n<<<<<<< .+\n|\n=======\n|\n>>>>>>> .+\n'

Some files were not shown because too many files have changed in this diff Show More