Skip to content

Commit 18aa1fc

Browse files
JohnVillalovosnejch
authored andcommitted
feat: add --no-mask-credentials CLI argument
This gives the ability to not mask credentials when using the `--debug` argument.
1 parent 9b4b0ef commit 18aa1fc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

gitlab/cli.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,12 @@ def _get_base_parser(add_help: bool = True) -> argparse.ArgumentParser:
308308
action="store_true",
309309
default=os.getenv("GITLAB_SKIP_LOGIN"),
310310
)
311+
parser.add_argument(
312+
"--no-mask-credentials",
313+
help="Don't mask credentials in debug mode",
314+
dest="mask_credentials",
315+
action="store_false",
316+
)
311317
return parser
312318

313319

@@ -395,6 +401,7 @@ def main() -> None:
395401
gitlab_resource = args.gitlab_resource
396402
resource_action = args.resource_action
397403
skip_login = args.skip_login
404+
mask_credentials = args.mask_credentials
398405

399406
args_dict = vars(args)
400407
# Remove CLI behavior-related args
@@ -406,6 +413,7 @@ def main() -> None:
406413
"gitlab",
407414
"gitlab_resource",
408415
"job_token",
416+
"mask_credentials",
409417
"oauth_token",
410418
"output",
411419
"pagination",
@@ -425,7 +433,7 @@ def main() -> None:
425433
try:
426434
gl = gitlab.Gitlab.merge_config(vars(options), gitlab_id, config_files)
427435
if debug:
428-
gl.enable_debug()
436+
gl.enable_debug(mask_credentials=mask_credentials)
429437
if not skip_login and (gl.private_token or gl.oauth_token):
430438
gl.auth()
431439
except Exception as e:

0 commit comments

Comments
 (0)