summaryrefslogtreecommitdiff
path: root/gitlab/cli.py
Commit message (Collapse)AuthorAgeFilesLines
* fix(cli): add ability to escape at-prefixed parameter (#2513)PyHedgehog2023-03-111-0/+2
| | | | | | | * fix(cli): Add ability to escape at-prefixed parameter (#2511) --------- Co-authored-by: Nejc Habjan <hab.nejc@gmail.com>
* chore(deps): update mypy (1.0.0) and responses (0.22.0)John L. Villalovos2023-02-071-1/+1
| | | | | | | | | | | | Update the `requirements-*` files. In order to update mypy==1.0.0 we need to also update responses==0.22.0 Fix one issue found by `mypy` Leaving updates for `precommit` to be done in a separate commit by someone.
* fix(cli): Enable debug before doing authEmanuele Aina2022-11-211-3/+2
| | | | | | | | | | | | | | | | Authentication issues are currently hard to debug since `--debug` only has effect after `gl.auth()` has been called. For example, a 401 error is printed without any details about the actual HTTP request being sent: $ gitlab --debug --server-url https://gitlab.com current-user get 401: 401 Unauthorized By moving the call to `gl.enable_debug()` the usual debug logs get printed before the final error message. Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
* chore: consolidate license and authorsNejc Habjan2022-08-041-19/+0
|
* chore: enable mypy check `warn_return_any`John L. Villalovos2022-07-281-3/+17
| | | | Update code so that the `warn_return_any` check passes.
* feat(cli): add a custom help formatterWaldek Maleska2022-07-281-0/+18
| | | | | | | | | | Add a custom argparse help formatter that overrides the output format to list items vertically. The formatter is derived from argparse.HelpFormatter with minimal changes. Co-authored-by: John Villalovos <john@sodarock.com> Co-authored-by: Nejc Habjan <nejc.habjan@siemens.com>
* Merge pull request #2051 from python-gitlab/jlvillal/more_more_pylintNejc Habjan2022-06-051-3/+3
|\ | | | | chore: enable more pylint checks
| * chore: enable pylint check: "redefined-outer-name",John L. Villalovos2022-06-041-2/+2
| | | | | | | | | | Enable the pylint check "redefined-outer-name" and fix the errors detected.
| * chore: enable pylint checksJohn L. Villalovos2022-06-041-1/+1
| | | | | | | | | | | | | | | | Enable the pylint checks: * unnecessary-pass * unspecified-encoding Update code to resolve errors found
* | chore: rename `whaction` and `action` to `resource_action` in CLIJohn L. Villalovos2022-06-051-3/+5
|/ | | | | Rename the variables `whaction` and `action` to `resource_action` to improve code-readability.
* chore: rename `what` to `gitlab_resource`John L. Villalovos2022-06-031-6/+8
| | | | | | | | | | | | Naming a variable `what` makes it difficult to understand what it is used for. Rename it to `gitlab_resource` as that is what is being stored. The Gitlab documentation talks about them being resources: https://docs.gitlab.com/ee/api/api_resources.html This will improve code readability.
* chore: correct ModuleNotFoundError() argumentsJohn L. Villalovos2022-05-291-1/+1
| | | | | | | | | | | Previously in commit 233b79ed442aac66faf9eb4b0087ea126d6dffc5 I had used the `name` argument for `ModuleNotFoundError()`. This basically is the equivalent of not passing any message to `ModuleNotFoundError()`. So when the exception was raised it wasn't very helpful. Correct that and add a unit-test that shows we get the message we expect.
* fix(cli): changed default `allow_abbrev` value to fix arguments collision ↵John Villalovos2022-05-091-1/+3
| | | | | problem (#2013) fix(cli): change default `allow_abbrev` value to fix argument collision
* fix(cli): make 'per_page' and 'page' type explicitThomas de Grenier de Latour2022-01-251-0/+1
|
* fix(cli): make 'timeout' type explicitThomas de Grenier de Latour2022-01-251-0/+1
|
* chore: consistently use open() encoding and file descriptorNejc Habjan2022-01-231-2/+2
|
* style: use literals to declare data structuresNejc Habjan2022-01-231-2/+2
|
* feat(cli): allow options from args and environment variablesNejc Habjan2022-01-021-5/+103
| | | | | | | | BREAKING-CHANGE: The gitlab CLI will now accept CLI arguments and environment variables for its global options in addition to configuration file options. This may change behavior for some workflows such as running inside GitLab CI and with certain environment variables configured.
* test(cli): improve basic CLI coveragetest/cli-coverageNejc Habjan2021-11-271-3/+3
|
* refactor: use f-strings for string formattingNejc Habjan2021-11-051-4/+4
|
* feat(api): add MR pipeline manager in favor of pipelines() methodNejc Habjan2021-06-131-1/+2
|
* chore: correct a type-hintJohn L. Villalovos2021-05-281-1/+2
|
* chore: fix import ordering using isortJohn L. Villalovos2021-05-251-1/+0
| | | | | | Fix the import ordering using isort. https://pycqa.github.io/isort/
* fix(cli): fix parsing CLI objects to classnamesNejc Habjan2021-05-151-7/+19
|
* chore: mypy: Disallow untyped definitionsJohn L. Villalovos2021-04-271-27/+28
| | | | | | | | | Be more strict and don't allow untyped definitions on the files we check. Also this adds type-hints for two of the decorators so that now functions/methods decorated by them will have their types be revealed correctly.
* chore: fix F841 errors reported by flake8John L. Villalovos2021-04-181-1/+0
| | | | | | Local variable name is assigned to but never used https://www.flake8rules.com/rules/F841.html
* chore: fix F401 errors reported by flake8John L. Villalovos2021-04-181-1/+1
| | | | | | F401: Module imported but unused https://www.flake8rules.com/rules/F401.html
* chore: disallow incomplete type defsJohn L. Villalovos2021-02-281-8/+11
| | | | | | | | | | Don't allow a partially annotated function definition. Either none of the function is annotated or all of it must be. Update code to ensure no-more partially annotated functions. Update gitlab/cli.py with better type-hints. Changed Tuple[Any, ...] to Tuple[str, ...]
* chore: add type-hints to gitlab/cli.pyJohn L. Villalovos2021-02-251-8/+11
|
* fix: wrong variable nameJohn L. Villalovos2021-02-251-1/+1
| | | | | Discovered this when I ran flake8 on the file. Unfortunately I was the one who introduced this wrong variable name :(
* feat: add an initial mypy test to tox.iniJohn L. Villalovos2021-02-221-1/+1
| | | | Add an initial mypy test to test gitlab/base.py and gitlab/__init__.py
* chore: explicitly import gitlab.v4.objects/cliJohn L. Villalovos2021-02-211-6/+13
| | | | | | | | | | | | | | | | | As we only support the v4 Gitlab API, explicitly import gitlab.v4.objects and gitlab.v4.clie instead of dynamically importing it depending on the API version. This has the added benefit of mypy being able to type check the Gitlab __init__() function as currently it will fail if we enable type checking of __init__() it will fail. Also, this also helps by not confusing tools like pyinstaller/cx_freeze with dynamic imports so you don't need hooks for standalone executables. And according to https://docs.gitlab.com/ee/api/, "GraphQL co-exists with the current v4 REST API. If we have a v5 API, this should be a compatibility layer on top of GraphQL."
* docs(cli): add auto-generated CLI referencedocs/cli-reference-pageNejc Habjan2020-10-111-0/+14
|
* chore: remove remnants of python2 importsNejc Habjan2020-08-221-1/+0
|
* feat: add autocompletion supportMartin Chlumsky2019-12-161-0/+6
|
* refactor: remove unused code, simplify string formatgodaji2019-10-061-1/+1
|
* feat: add support for job tokenMathieu Parent2019-09-061-1/+1
| | | | See https://docs.gitlab.com/ee/api/jobs.html#get-job-artifacts for usage
* fix(cli): don't fail when the short print attr value is Nonexarx002019-07-211-2/+2
| | | | | Fixes #717 Fixes #727
* refactor: format everything blackrefactor/blackMax Wittig2019-05-161-42/+67
|
* Use sys.exit as in rest of codeHakan Fouren2019-03-071-2/+2
|
* Re-enable command specific help mesaagesHakan Fouren2019-03-061-3/+3
| | | | This makes sure that the global help message wont be printed instead of the command spedific one unless we fail to read the configuration file
* fix(cli): exit on config parse error, instead of crashingMax Wittig2018-11-041-3/+8
| | | | * Exit and hint user about possible errors * test: adjust test cases to config missing error
* fix(cli): print help and usage without config filefix/help-usageMax Wittig2018-10-041-1/+5
| | | | Fixes #560
* silence logs/warnings in unittestsCyril Jouve2018-06-071-1/+2
|
* pep8 fixGauvain Pocentek2018-03-111-1/+2
|
* [cli] Restore the --help option behaviorGauvain Pocentek2018-03-111-3/+9
| | | | Fixes #381
* [cli] Allow to read args from filesGauvain Pocentek2018-03-051-1/+14
| | | | | | | With the @/file/path syntax (similar to curl) user can provide values from attributes in files. Fixes #448
* Add support for oauth and anonymous auth in config/CLIGauvain Pocentek2017-11-101-2/+3
|
* pep8 fixGauvain Pocentek2017-09-071-1/+1
|
* [v4] fix CLI for some mixin methodsGauvain Pocentek2017-09-071-10/+15
|