Skip to content

Commit

Permalink
remove --tag argument from mxpy deps
Browse files Browse the repository at this point in the history
  • Loading branch information
popenta committed Oct 3, 2023
1 parent 8c35561 commit 96d21cf
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 24 deletions.
70 changes: 53 additions & 17 deletions CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,12 @@ usage: mxpy contract new [-h] ...
Create a new Smart Contract project based on a template.
positional arguments:
name
options:
-h, --help show this help message and exit
--template TEMPLATE the template to use
--directory DIRECTORY 🗀 the parent directory of the project (default: current directory)
-h, --help show this help message and exit
--name NAME The name of the contract. If missing, the name of the template will be used.
--template TEMPLATE the template to use
--tag TAG the framework version on which the contract should be created
--path PATH the parent directory of the project (default: current directory)
```
### Contract.Templates
Expand All @@ -105,6 +104,7 @@ List the available Smart Contract templates.
options:
-h, --help show this help message and exit
--tag TAG the sc-meta framework version referred to
```
### Contract.Build
Expand Down Expand Up @@ -994,7 +994,7 @@ usage: mxpy wallet COMMAND [-h] ...
Create wallet, derive secret key from mnemonic, bech32 address helpers etc.
COMMANDS:
{new,convert,bech32}
{new,convert,bech32,sign-message,verify-message}
OPTIONS:
-h, --help show this help message and exit
Expand All @@ -1005,6 +1005,8 @@ COMMANDS summary
new Create a new wallet and print its mnemonic; optionally save as password-protected JSON (recommended) or PEM (not recommended)
convert Convert a wallet from one format to another
bech32 Helper for encoding and decoding bech32 addresses
sign-message Sign a message
verify-message Verify a previously message
```
### Wallet.New
Expand Down Expand Up @@ -1041,7 +1043,7 @@ options:
--outfile OUTFILE path to the output file
--in-format {raw-mnemonic,keystore-mnemonic,keystore-secret-key,pem}
the format of the input file
--out-format {raw-mnemonic,keystore-mnemonic,keystore-secret-key,pem}
--out-format {raw-mnemonic,keystore-mnemonic,keystore-secret-key,pem,address-bech32,address-hex}
the format of the output file
--address-index ADDRESS_INDEX the address index, if input format is raw-mnemonic, keystore-mnemonic
or pem (with multiple entries) and the output format is keystore-
Expand All @@ -1067,6 +1069,44 @@ options:
--encode whether to encode
--decode whether to decode
```
### Wallet.SignMessage


```
$ mxpy wallet sign-message --help
usage: mxpy wallet sign-message [-h] ...
Sign a message
options:
-h, --help show this help message and exit
--message MESSAGE the message you want to sign
--pem PEM 🔑 the PEM file, if keyfile not provided
--pem-index PEM_INDEX 🔑 the index in the PEM file (default: 0)
--keyfile KEYFILE 🔑 a JSON keyfile, if PEM not provided
--passfile PASSFILE 🔑 a file containing keyfile's password, if keyfile provided
--ledger 🔐 bool flag for signing transaction using ledger
--ledger-account-index LEDGER_ACCOUNT_INDEX 🔐 the index of the account when using Ledger
--ledger-address-index LEDGER_ADDRESS_INDEX 🔐 the index of the address when using Ledger
--sender-username SENDER_USERNAME 🖄 the username of the sender
```
### Wallet.VerifyMessage


```
$ mxpy wallet verify-message --help
usage: mxpy wallet verify-message [-h] ...
Verify a previously message
options:
-h, --help show this help message and exit
--bech32-address BECH32_ADDRESS the bech32 address of the signer
--message MESSAGE the previously signed message(readable text, as it was signed)
--signature SIGNATURE the signature in hex format
```
## Group **Localnet**

Expand Down Expand Up @@ -1217,13 +1257,11 @@ usage: mxpy deps install [-h] ...
Install dependencies or multiversx-sdk modules.
positional arguments:
{all,llvm,clang,cpp,rust,golang,vmtools,mx_chain_go,mx_chain_proxy_go,wasm-opt,twiggy,testwallets}
the dependency to install
{all,rust,golang,vmtools,testwallets} the dependency to install
options:
-h, --help show this help message and exit
--overwrite whether to overwrite an existing installation
--tag TAG the tag or version to install
-h, --help show this help message and exit
--overwrite whether to overwrite an existing installation
```
### Dependencies.Check
Expand All @@ -1236,12 +1274,10 @@ usage: mxpy deps check [-h] ...
Check whether a dependency is installed.
positional arguments:
{all,llvm,clang,cpp,rust,golang,vmtools,mx_chain_go,mx_chain_proxy_go,wasm-opt,twiggy,testwallets}
the dependency to check
{all,rust,golang,vmtools,testwallets} the dependency to check
options:
-h, --help show this help message and exit
--tag TAG the tag or version to check
-h, --help show this help message and exit
```
## Group **Configuration**
Expand Down
2 changes: 2 additions & 0 deletions CLI.md.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ generate() {
command "Wallet.New" "wallet new"
command "Wallet.Convert" "wallet convert"
command "Wallet.Bech32" "wallet bech32"
command "Wallet.SignMessage" "wallet sign-message"
command "Wallet.VerifyMessage" "wallet verify-message"

group "Localnet" "localnet"
command "Localnet.Setup" "localnet setup"
Expand Down
9 changes: 3 additions & 6 deletions multiversx_sdk_cli/cli_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def setup_parser(subparsers: Any) -> Any:

sub = cli_shared.add_command_subparser(subparsers, "deps", "check", "Check whether a dependency is installed.")
sub.add_argument("name", choices=choices, help="the dependency to check")
sub.add_argument("--tag", help="the tag or version to check")
sub.set_defaults(func=check)

parser.epilog = cli_shared.build_group_epilog(subparsers)
Expand All @@ -35,18 +34,16 @@ def install(args: Any):

def check(args: Any):
name: str = args.name
tag: str = args.tag
module = dependencies.get_module_by_key(name)
default_tag: str = config.get_dependency_tag(module.key)
tag_to_check = tag or default_tag
tag_to_check: str = config.get_dependency_tag(module.key)
resolution: str = config.get_dependency_resolution(module.key)
resolution = resolution if resolution else "HOST"

logger.info(f"Checking dependency: module = {module.key}, tag = {tag_to_check}; default tag = {default_tag}, resolution = {resolution}")
logger.info(f"Checking dependency: module = {module.key}, tag = {tag_to_check}, resolution = {resolution}")

installed = module.is_installed(tag_to_check)
if installed:
logger.info(f"[{name} {tag_to_check}] is installed. Default version (tag) is [{default_tag}].")
logger.info(f"[{name} {tag_to_check}] is installed.")
return

raise errors.DependencyMissing(name, tag_to_check)
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/dependencies/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _get_download_url(self, tag: str) -> str:
platform = workstation.get_platform()

url = config.get_dependency_url(self.key, tag, platform)
if url is None:
if not url:
raise errors.PlatformNotSupported(self.key, platform)

url = url.replace("{TAG}", tag)
Expand Down

0 comments on commit 96d21cf

Please sign in to comment.