Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions 11 docs/cli-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,17 @@ command line. This is handy for values containing new lines for instance:
EOF
$ gitlab project create --name SuperProject --description @/tmp/description

It you want to explicitly pass an argument starting with ``@``, you can escape it using ``@@``:

.. code-block:: console

$ gitlab project-tag list --project-id somenamespace/myproject
...
name: @at-started-tag
...
$ gitlab project-tag delete --project-id somenamespace/myproject --name '@@at-started-tag'


Enabling shell autocompletion
=============================

Expand Down
2 changes: 2 additions & 0 deletions 2 gitlab/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ def _get_parser() -> argparse.ArgumentParser:


def _parse_value(v: Any) -> Any:
if isinstance(v, str) and v.startswith("@@"):
return v[1:]
if isinstance(v, str) and v.startswith("@"):
# If the user-provided value starts with @, we try to read the file
# path provided after @ as the real value. Exit on any error.
Expand Down
20 changes: 20 additions & 0 deletions 20 tests/functional/cli/test_cli_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,26 @@ def test_create_project_with_values_from_file(gitlab_cli, tmpdir):
assert description in ret.stdout


def test_create_project_with_values_at_prefixed(gitlab_cli, tmpdir):
name = "gitlab-project-at-prefixed"
description = "@at-prefixed"
at_prefixed = f"@{description}"

cmd = [
"-v",
"project",
"create",
"--name",
name,
"--description",
at_prefixed,
]
ret = gitlab_cli(cmd)

assert ret.success
assert description in ret.stdout


def test_create_project_deploy_token(gitlab_cli, project):
name = "project-token"
username = "root"
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.