Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit4f7c784

Browse files
pyhedgehognejch
andauthored
fix(cli): add ability to escape at-prefixed parameter (#2513)
* fix(cli): Add ability to escape at-prefixed parameter (#2511)---------Co-authored-by: Nejc Habjan <hab.nejc@gmail.com>
1 parent7d779c8 commit4f7c784

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

‎docs/cli-usage.rst‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,17 @@ command line. This is handy for values containing new lines for instance:
305305
EOF
306306
$ gitlab project create --name SuperProject --description @/tmp/description
307307
308+
It you want to explicitly pass an argument starting with ``@``, you can escape it using ``@@``:
309+
310+
..code-block::console
311+
312+
$ gitlab project-tag list --project-id somenamespace/myproject
313+
...
314+
name: @at-started-tag
315+
...
316+
$ gitlab project-tag delete --project-id somenamespace/myproject --name '@@at-started-tag'
317+
318+
308319
Enabling shell autocompletion
309320
=============================
310321

‎gitlab/cli.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ def _get_parser() -> argparse.ArgumentParser:
272272

273273

274274
def_parse_value(v:Any)->Any:
275+
ifisinstance(v,str)andv.startswith("@@"):
276+
returnv[1:]
275277
ifisinstance(v,str)andv.startswith("@"):
276278
# If the user-provided value starts with @, we try to read the file
277279
# path provided after @ as the real value. Exit on any error.

‎tests/functional/cli/test_cli_v4.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,26 @@ def test_create_project_with_values_from_file(gitlab_cli, tmpdir):
562562
assertdescriptioninret.stdout
563563

564564

565+
deftest_create_project_with_values_at_prefixed(gitlab_cli,tmpdir):
566+
name="gitlab-project-at-prefixed"
567+
description="@at-prefixed"
568+
at_prefixed=f"@{description}"
569+
570+
cmd= [
571+
"-v",
572+
"project",
573+
"create",
574+
"--name",
575+
name,
576+
"--description",
577+
at_prefixed,
578+
]
579+
ret=gitlab_cli(cmd)
580+
581+
assertret.success
582+
assertdescriptioninret.stdout
583+
584+
565585
deftest_create_project_deploy_token(gitlab_cli,project):
566586
name="project-token"
567587
username="root"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp