Skip to content

Commit

Permalink
Merge pull request #2542 from carapace-sh/glab-updates-v1.47.0
Browse files Browse the repository at this point in the history
glab: updates from v1.47.0
  • Loading branch information
rsteube authored Oct 3, 2024
2 parents 9f18adb + d404926 commit ac55cef
Show file tree
Hide file tree
Showing 137 changed files with 1,155 additions and 478 deletions.
2 changes: 1 addition & 1 deletion completers/glab_completer/cmd/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

var aliasCmd = &cobra.Command{
Use: "alias [command] [flags]",
Short: "Create, list and delete aliases",
Short: "Create, list, and delete aliases.",
Run: func(cmd *cobra.Command, args []string) {},
}

Expand Down
4 changes: 2 additions & 2 deletions completers/glab_completer/cmd/alias_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (

var alias_setCmd = &cobra.Command{
Use: "set <alias name> '<command>' [flags]",
Short: "Set an alias.",
Short: "Set an alias for a longer command.",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(alias_setCmd).Standalone()

alias_setCmd.Flags().BoolP("shell", "s", false, "Declare an alias to be passed through a shell interpreter")
alias_setCmd.Flags().BoolP("shell", "s", false, "Declare an alias to be passed through a shell interpreter.")
aliasCmd.AddCommand(alias_setCmd)

carapace.Gen(alias_setCmd).PositionalCompletion(
Expand Down
20 changes: 10 additions & 10 deletions completers/glab_completer/cmd/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ import (

var apiCmd = &cobra.Command{
Use: "api <endpoint>",
Short: "Make an authenticated request to GitLab API",
Short: "Make an authenticated request to the GitLab API.",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(apiCmd).Standalone()

apiCmd.Flags().StringSliceP("field", "F", []string{}, "Add a parameter of inferred type (changes default HTTP method to \"POST\")")
apiCmd.Flags().StringSliceP("header", "H", []string{}, "Add an additional HTTP request header")
apiCmd.Flags().String("hostname", "", "The GitLab hostname for the request (default is \"gitlab.com\" or authenticated host in current git directory)")
apiCmd.Flags().BoolP("include", "i", false, "Include HTTP response headers in the output")
apiCmd.Flags().String("input", "", "The file to use as body for the HTTP request")
apiCmd.Flags().StringP("method", "X", "", "The HTTP method for the request")
apiCmd.Flags().Bool("paginate", false, "Make additional HTTP requests to fetch all pages of results")
apiCmd.Flags().StringSliceP("raw-field", "f", []string{}, "Add a string parameter")
apiCmd.Flags().Bool("silent", false, "Do not print the response body")
apiCmd.Flags().StringSliceP("field", "F", []string{}, "Add a parameter of inferred type. Changes the default HTTP method to \"POST\".")
apiCmd.Flags().StringSliceP("header", "H", []string{}, "Add an additional HTTP request header.")
apiCmd.Flags().String("hostname", "", "The GitLab hostname for the request. Defaults to \"gitlab.com\", or the authenticated host in the current Git directory.")
apiCmd.Flags().BoolP("include", "i", false, "Include HTTP response headers in the output.")
apiCmd.Flags().String("input", "", "The file to use as the body for the HTTP request.")
apiCmd.Flags().StringP("method", "X", "", "The HTTP method for the request.")
apiCmd.Flags().Bool("paginate", false, "Make additional HTTP requests to fetch all pages of results.")
apiCmd.Flags().StringSliceP("raw-field", "f", []string{}, "Add a string parameter.")
apiCmd.Flags().Bool("silent", false, "Do not print the response body.")
rootCmd.AddCommand(apiCmd)

carapace.Gen(apiCmd).FlagCompletion(carapace.ActionMap{
Expand Down
18 changes: 0 additions & 18 deletions completers/glab_completer/cmd/ask.go

This file was deleted.

18 changes: 0 additions & 18 deletions completers/glab_completer/cmd/ask_git.go

This file was deleted.

2 changes: 1 addition & 1 deletion completers/glab_completer/cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

var authCmd = &cobra.Command{
Use: "auth <command>",
Short: "Manage glab's authentication state",
Short: "Manage glab's authentication state.",
Run: func(cmd *cobra.Command, args []string) {},
}

Expand Down
2 changes: 1 addition & 1 deletion completers/glab_completer/cmd/auth_gitCredential.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

var auth_gitCredentialCmd = &cobra.Command{
Use: "git-credential",
Short: "Implements Git credential helper manager",
Short: "Implements Git credential helper manager.",
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {},
}
Expand Down
10 changes: 5 additions & 5 deletions completers/glab_completer/cmd/auth_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import (

var auth_loginCmd = &cobra.Command{
Use: "login",
Short: "Authenticate with a GitLab instance",
Short: "Authenticate with a GitLab instance.",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(auth_loginCmd).Standalone()

auth_loginCmd.Flags().StringP("hostname", "h", "", "The hostname of the GitLab instance to authenticate with")
auth_loginCmd.Flags().Bool("stdin", false, "Read token from standard input")
auth_loginCmd.Flags().StringP("token", "t", "", "Your GitLab access token")
auth_loginCmd.Flags().Bool("use-keyring", false, "Store token in your operating system's keyring")
auth_loginCmd.Flags().StringP("hostname", "h", "", "The hostname of the GitLab instance to authenticate with.")
auth_loginCmd.Flags().Bool("stdin", false, "Read token from standard input.")
auth_loginCmd.Flags().StringP("token", "t", "", "Your GitLab access token.")
auth_loginCmd.Flags().Bool("use-keyring", false, "Store token in your operating system's keyring.")
authCmd.AddCommand(auth_loginCmd)

carapace.Gen(auth_loginCmd).FlagCompletion(carapace.ActionMap{
Expand Down
6 changes: 3 additions & 3 deletions completers/glab_completer/cmd/auth_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (

var auth_statusCmd = &cobra.Command{
Use: "status",
Short: "View authentication status",
Short: "View authentication status.",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(auth_statusCmd).Standalone()

auth_statusCmd.Flags().StringP("hostname", "h", "", "Check a specific instance's authentication status")
auth_statusCmd.Flags().BoolP("show-token", "t", false, "Display the auth token")
auth_statusCmd.Flags().StringP("hostname", "h", "", "Check a specific instance's authentication status.")
auth_statusCmd.Flags().BoolP("show-token", "t", false, "Display the authentication token.")
authCmd.AddCommand(auth_statusCmd)

carapace.Gen(auth_statusCmd).FlagCompletion(carapace.ActionMap{
Expand Down
2 changes: 1 addition & 1 deletion completers/glab_completer/cmd/changelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

var changelogCmd = &cobra.Command{
Use: "changelog <command> [flags]",
Short: "Interact with the changelog API",
Short: "Interact with the changelog API.",
Run: func(cmd *cobra.Command, args []string) {},
}

Expand Down
14 changes: 7 additions & 7 deletions completers/glab_completer/cmd/changelog_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import (

var changelog_generateCmd = &cobra.Command{
Use: "generate [flags]",
Short: "Generate a changelog for the repository/project",
Short: "Generate a changelog for the repository or project.",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(changelog_generateCmd).Standalone()

changelog_generateCmd.Flags().String("config-file", "", "The path of changelog configuration file in the project's Git repository. Defaults to .gitlab/changelog_config.yml.")
changelog_generateCmd.Flags().String("date", "", "The date and time of the release. Uses ISO 8601 (2016-03-11T03:45:40Z) format. Defaults to the current time.")
changelog_generateCmd.Flags().String("from", "", "The start of the range of commits (as a SHA) to use for generating the changelog. This commit itself isn't included in the list.")
changelog_generateCmd.Flags().String("to", "", "The end of the range of commits (as a SHA) to use for the changelog. This commit is included in the list. Defaults to the HEAD of the default project branch.")
changelog_generateCmd.Flags().String("trailer", "", "The Git trailer to use for including commits. Defaults to Changelog.")
changelog_generateCmd.Flags().StringP("version", "v", "", "The version to generate the changelog for. The format must follow semantic versioning. Defaults to the version of the local checkout (like using git describe).")
changelog_generateCmd.Flags().String("config-file", "", "Path of the changelog configuration file in the project's Git repository. Defaults to '.gitlab/changelog_config.yml'.")
changelog_generateCmd.Flags().String("date", "", "Date and time of the release. Uses ISO 8601 (`2016-03-11T03:45:40Z`) format. Defaults to the current time.")
changelog_generateCmd.Flags().String("from", "", "Start of the range of commits (as a SHA) to use when generating the changelog. This commit itself isn't included in the list.")
changelog_generateCmd.Flags().String("to", "", "End of the range of commits (as a SHA) to use when generating the changelog. This commit is included in the list. Defaults to the HEAD of the project's default branch.")
changelog_generateCmd.Flags().String("trailer", "", "The Git trailer to use for including commits. Defaults to 'Changelog'.")
changelog_generateCmd.Flags().StringP("version", "v", "", "Version to generate the changelog for. Must follow semantic versioning. Defaults to the version of the local checkout, like using 'git describe'.")
changelogCmd.AddCommand(changelog_generateCmd)

carapace.Gen(changelog_generateCmd).FlagCompletion(carapace.ActionMap{
Expand Down
2 changes: 1 addition & 1 deletion completers/glab_completer/cmd/checkUpdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

var checkUpdateCmd = &cobra.Command{
Use: "check-update",
Short: "Check for latest glab releases",
Short: "Check for latest glab releases.",
Aliases: []string{"update"},
Run: func(cmd *cobra.Command, args []string) {},
}
Expand Down
4 changes: 2 additions & 2 deletions completers/glab_completer/cmd/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (

var ciCmd = &cobra.Command{
Use: "ci <command> [flags]",
Short: "Work with GitLab CI/CD pipelines and jobs",
Short: "Work with GitLab CI/CD pipelines and jobs.",
Aliases: []string{"pipe", "pipeline"},
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(ciCmd).Standalone()

ciCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the `OWNER/REPO` or `GROUP/NAMESPACE/REPO` format or full URL or git URL")
ciCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository. Can use either `OWNER/REPO` or `GROUP/NAMESPACE/REPO` format. Also accepts full URL or Git URL.")
rootCmd.AddCommand(ciCmd)

carapace.Gen(ciCmd).FlagCompletion(carapace.ActionMap{
Expand Down
26 changes: 0 additions & 26 deletions completers/glab_completer/cmd/ci_artifact.go

This file was deleted.

18 changes: 18 additions & 0 deletions completers/glab_completer/cmd/ci_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var ci_configCmd = &cobra.Command{
Use: "config <command> [flags]",
Short: "Work with GitLab CI/CD configuration.",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(ci_configCmd).Standalone()

ciCmd.AddCommand(ci_configCmd)
}
18 changes: 18 additions & 0 deletions completers/glab_completer/cmd/ci_config_compile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var ci_config_compileCmd = &cobra.Command{
Use: "compile",
Short: "View the fully expanded CI/CD configuration.",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(ci_config_compileCmd).Standalone()

ci_configCmd.AddCommand(ci_config_compileCmd)
}
40 changes: 36 additions & 4 deletions completers/glab_completer/cmd/ci_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,56 @@ package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/glab_completer/cmd/action"
"github.com/carapace-sh/carapace/pkg/style"
"github.com/spf13/cobra"
)

var ci_deleteCmd = &cobra.Command{
Use: "delete <id> [flags]",
Short: "Delete a CI/CD pipeline",
Short: "Delete CI/CD pipelines.",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(ci_deleteCmd).Standalone()

ci_deleteCmd.Flags().Bool("dry-run", false, "simulate process, but do not delete anything")
ci_deleteCmd.Flags().StringP("status", "s", "", "delete pipelines by status: {running|pending|success|failed|canceled|skipped|created|manual}")
ci_deleteCmd.Flags().Bool("dry-run", false, "Simulate process, but do not delete anything.")
ci_deleteCmd.Flags().String("older-than", "", "Filter pipelines older than the given duration. Valid units: h, m, s, ms, us, ns.")
ci_deleteCmd.Flags().String("page", "", "Page number.")
ci_deleteCmd.Flags().Bool("paginate", false, "Make additional HTTP requests to fetch all pages of projects before cloning. Respects '--per-page'.")
ci_deleteCmd.Flags().String("per-page", "", "Number of items to list per page.")
ci_deleteCmd.Flags().String("source", "", "Filter pipelines by source: api, chat, external, external_pull_request_event, merge_request_event, ondemand_dast_scan, ondemand_dast_validation, parent_pipeline, pipeline, push, schedule, security_orchestration_policy, trigger, web, webide.")
ci_deleteCmd.Flags().StringP("status", "s", "", "Delete pipelines by status: running, pending, success, failed, canceled, skipped, created, manual.")
ciCmd.AddCommand(ci_deleteCmd)

carapace.Gen(ci_deleteCmd).FlagCompletion(carapace.ActionMap{
"status": carapace.ActionValues("running", "pending", "success", "failed", "canceled", "skipped", "created", "manual"),
"source": carapace.ActionValues(
"api",
"chat",
"external",
"external_pull_request_event",
"merge_request_event",
"ondemand_dast_scan",
"ondemand_dast_validation",
"parent_pipeline",
"pipeline",
"push",
"schedule",
"security_orchestration_policy",
"trigger",
"web",
"webide",
),
"status": carapace.ActionValues(
"running",
"pending",
"success",
"failed",
"canceled",
"skipped",
"created",
"manual",
).StyleF(style.ForKeyword),
})

carapace.Gen(ci_deleteCmd).PositionalCompletion(
Expand Down
16 changes: 10 additions & 6 deletions completers/glab_completer/cmd/ci_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,27 @@ import (

var ci_getCmd = &cobra.Command{
Use: "get [flags]",
Short: "Get JSON of a running CI/CD pipeline on the current or other specified branch",
Short: "Get JSON of a running CI/CD pipeline on the current or other specified branch.",
Aliases: []string{"stats"},
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(ci_getCmd).Standalone()

ci_getCmd.Flags().StringP("branch", "b", "", "Check pipeline status for a branch. (Default is current branch)")
ci_getCmd.Flags().StringP("output-format", "o", "", "Format output as: text, json")
ci_getCmd.Flags().StringP("pipeline-id", "p", "", "Provide pipeline ID")
ci_getCmd.Flags().Bool("with-variables", false, "Show variables in pipeline (maintainer role required)")
ci_getCmd.Flags().StringP("branch", "b", "", "Check pipeline status for a branch. (Default: current branch)")
ci_getCmd.Flags().StringP("output", "F", "", "Format output. Options: text, json.")
ci_getCmd.Flags().StringP("output-format", "o", "", "Use output.")
ci_getCmd.Flags().StringP("pipeline-id", "p", "", "Provide pipeline ID.")
ci_getCmd.Flags().BoolP("with-job-details", "d", false, "Show extended job information.")
ci_getCmd.Flags().Bool("with-variables", false, "Show variables in pipeline. Requires the Maintainer role.")
ci_getCmd.Flag("output-format").Hidden = true
ciCmd.AddCommand(ci_getCmd)

carapace.Gen(ci_getCmd).FlagCompletion(carapace.ActionMap{
"branch": action.ActionBranches(ci_getCmd),
"output": carapace.ActionValues("text", "json"),
"output-format": carapace.ActionValues("text", "json"),
"pipeline-id": action.ActionPipelines(ci_getCmd, "running"),
"pipeline-id": action.ActionPipelines(ci_getCmd, ""),
})
}
Loading

0 comments on commit ac55cef

Please sign in to comment.