Skip to content

Commit

Permalink
Merge pull request #406 from multiversx/shell-completions
Browse files Browse the repository at this point in the history
Add shell completions
  • Loading branch information
popenta authored Feb 1, 2024
2 parents f883790 + 037bec1 commit 106bde2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
3 changes: 3 additions & 0 deletions multiversx_sdk_cli/cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# PYTHON_ARGCOMPLETE_OK
import argparse
import logging
import sys
from argparse import ArgumentParser
from typing import Any, List

import argcomplete
from rich.logging import RichHandler

import multiversx_sdk_cli.cli_accounts
Expand Down Expand Up @@ -41,6 +43,7 @@ def _do_main(cli_args: List[str]):
utils.ensure_folder(config.SDK_PATH)
argv_with_config_args = config.add_config_args(cli_args)
parser = setup_parser(argv_with_config_args)
argcomplete.autocomplete(parser)
args = parser.parse_args(argv_with_config_args)

if args.verbose:
Expand Down
13 changes: 0 additions & 13 deletions multiversx_sdk_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,24 +202,11 @@ def add_config_args(argv: List[str]) -> List[str]:
except KeyError:
return argv

check_for_deprecated_args(config_args)

final_args = determine_final_args(argv, config_args)
print(f"Found extra arguments in mxpy.json. Final arguments: {final_args}")
return final_args


def check_for_deprecated_args(args: List[str]) -> None:
if "proxy" in args:
show_warning("Providing `proxy` in the configuration file is deprecated. It will not be used. Please remove it!")

if "chainID" in args:
show_warning("Providing `chainID` in the configuration file is deprecated. It will not be used. Please remove it!")

if "txVersion" in args:
show_warning("Providing `txVersion` in the configuration file is deprecated. It will not be used. Please remove it!")


def determine_final_args(argv: List[str], config_args: Dict[str, Any]) -> List[str]:
extra_args: List[str] = []
for key, value in config_args.items():
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ dependencies = [
"rich==13.3.4",
"multiversx-sdk-network-providers>=0.12.0,<0.13.0",
"multiversx-sdk-wallet>=0.8.0,<0.9.0,",
"multiversx-sdk-core>=0.7.0,<0.8.0"
"multiversx-sdk-core>=0.7.0,<0.8.0",
"argcomplete==3.2.2"
]

[project.scripts]
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ledgercomm[hid]
semver
requests-cache
rich==13.3.4
argcomplete==3.2.2

multiversx-sdk-core>=0.7.0,<0.8.0
multiversx-sdk-network-providers>=0.12.0,<0.13.0
Expand Down

0 comments on commit 106bde2

Please sign in to comment.