-
Notifications
You must be signed in to change notification settings - Fork 42
Apl 2024 replace jcommander with pico cli #1162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
0486
wants to merge
12
commits into
develop
Choose a base branch
from
APL-2024-replace-jcommander-with-PicoCLI
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3d2b40c
Added picocli dependencies, updated bom-ext dependency
0486 c4a06f8
Replaced JCommander parameters to picoCLI options
0486 97b734d
Replaced JCommander to PicoLCI
0486 b3cc87b
Corrected typo
0486 16ac72d
Made project compilable
0486 37bc985
Added help
0486 28b0120
Added help
0486 b38014c
Removing artifacts
0486 97eebc7
Fixed app name, formatting and block aligning
0486 453628b
merged 'develop' branch
blandger b8f258a
updated command line params, added unit test
blandger 9026545
updated poms
blandger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 40 additions & 28 deletions
68
apl-exec/src/main/java/com/apollocurrency/aplwallet/apl/exec/CmdLineArgs.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,64 +1,76 @@ | ||
| package com.apollocurrency.aplwallet.apl.exec; | ||
|
|
||
| import com.beust.jcommander.Parameter; | ||
|
|
||
| /** | ||
| /* | ||
| * Copyright © 2018-2022 Apollo Foundation | ||
| * Command line parameters | ||
| * | ||
| * @author [email protected] | ||
| * @author [email protected] | ||
| */ | ||
|
|
||
| package com.apollocurrency.aplwallet.apl.exec; | ||
|
|
||
| import picocli.CommandLine.Command; | ||
| import picocli.CommandLine.Option; | ||
|
|
||
| @Command(name = "apollo-blockchain") | ||
| public class CmdLineArgs { | ||
|
|
||
| public static int DEFAULT_DEBUG_LEVEL = 2; | ||
|
|
||
| @Parameter(names = {"--debug", "-d"}, description = "Debug level [0-4] from ERROR to TRACE") | ||
| @Option(names = {"--debug", "-d"}, description = "Common debug level [0-4] from ERROR=0, WARN=1, INFO=2, DEBUG=3, TRACE=4") | ||
| public int debug = DEFAULT_DEBUG_LEVEL; | ||
| @Parameter(names = {"--debug-updater", "-du"}, description = "Force updater to use debug certificates for verifying update transactions") | ||
| @Option(names = {"--debug-updater", "-du"}, description = "Force updater to use debug certificates for verifying update transactions") | ||
| public boolean debugUpdater; | ||
| @Parameter(names = {"--help", "-h"}, help = true, description = "Print help message") | ||
| @Option(names = {"--help", "-h"}, usageHelp = true, help = true, description = "Print help message") | ||
| public boolean help; | ||
| @Parameter(names = {"--service-mode", "-s"}, help = true, description = "Run in service mode with current system user") | ||
| @Option(names = {"--service-mode", "-s"}, arity = "0..1", defaultValue = "false", fallbackValue = "true", description = "Run in service mode with current system user") | ||
| public boolean serviceMode; | ||
| @Parameter(names = {"--ignore-resources"}, description = "Ignore resources bundled with application jar. Default is false") | ||
| public boolean ingnoreResources = false; | ||
| @Parameter(names = {"--config-dir", "-c"}, description = "Load all configuration and resources from specified path. System resources not ignored, standard config search is ignored.") | ||
| @Option(names = {"--ignore-resources"}, description = "Ignore resources bundled with application jar. Default is false") | ||
| public boolean ignoreResources = false; | ||
| @Option(names = {"--config-dir", "-c"}, description = "Load all configuration and resources from specified path. System resources not ignored, standard config search is ignored.") | ||
| public String configDir = ""; | ||
| @Parameter(names = {"--log-dir", "-l"}, description = "Save log files to from specified directory.") | ||
| @Option(names = {"--log-dir", "-l"}, description = "Save log files to from specified directory.") | ||
| public String logDir = ""; | ||
| @Parameter(names = {"--db-dir"}, description = "Load/Save DB files to from specified directory. Ignored if DB URL is remote.") | ||
| @Option(names = {"--db-dir"}, description = "Load/Save DB files to from specified directory. Ignored if DB URL is remote.") | ||
| public String dbDir = ""; | ||
| @Parameter(names = {"--vault-key-dir"}, description = "Load/Save vault wallets keys to/form specified keystore directory.") | ||
| @Option(names = {"--vault-key-dir"}, description = "Load/Save vault wallets keys to/form specified keystore directory.") | ||
| public String vaultKeystoreDir = ""; | ||
| @Parameter(names = {"--dex-key-dir"}, description = "Load/Save dex keys to/form specified keystore directory.") | ||
| @Option(names = {"--dex-key-dir"}, description = "Load/Save dex keys to/form specified keystore directory.") | ||
| public String dexKeystoreDir = ""; | ||
| @Parameter(names = {"--no-shard-import"}, description = "Start from Genesis block, do not try to import last shard") | ||
| @Option(names = {"--no-shard-import"}, arity = "0..1", defaultValue = "false", fallbackValue = "true", | ||
| description = "Empty node starts downloading blocks from Genesis block, does not try to import last shard downloaded from another sharded nodes." + | ||
| " Default: ${DEFAULT-VALUE}, if specified without parameter value is: ${FALLBACK-VALUE}." | ||
| ) | ||
| public boolean noShardImport = false; | ||
| @Parameter(names = {"--no-shard-create"}, description = "Do not create shards even if it configured to do so. Shards require much more resources") | ||
| @Option(names = {"--no-shard-create"}, arity = "0..1", defaultValue = "false", fallbackValue = "true", | ||
| description = "Do not create shards even if it configured to do so, default: ${DEFAULT-VALUE}, " + | ||
| "if specified without parameter: ${FALLBACK-VALUE}. Shards are require more OS resources." | ||
| ) | ||
| public boolean noShardCreate = false; | ||
|
|
||
| @Parameter(names = {"--update-attachment-file", "-u"}, description = "Full path to file which represent json of UpdateAttachment for local updates debug") | ||
| @Option(names = {"--update-attachment-file", "-u"}, | ||
| description = "Full path to file which represent json of UpdateAttachment for local updates with debugging purpose.") | ||
| public String updateAttachmentFile = ""; | ||
|
|
||
| // TODO cleanup apl-default.properties | ||
| @Parameter(names = {"--2fa-dir"}, description = "Load/Save 2FA keys to/form specified directory. Note that this parameter will not work when you do not set apl.store2FAInFileSystem=true in apl-default.properties") | ||
| @Option(names = {"--2fa-dir"}, description = "Load/Save 2FA keys to/form specified directory. Note that this Option will not work when you do not set apl.store2FAInFileSystem=true in apl-default.properties") | ||
| public String twoFactorAuthDir = ""; | ||
| @Parameter(names = {"--dexp-dir"}, description = "Export/Import CSV data to/form specified directory.") | ||
| @Option(names = {"--dexp-dir"}, description = "Export/Import CSV data to/form specified directory.") | ||
| public String dataExportDir = ""; | ||
| @Parameter(names = {"--pid-file"}, description = "Save PID to specified file.") | ||
| @Option(names = {"--pid-file"}, description = "Save PID to specified file.") | ||
| public String pidFile = ""; | ||
| @Parameter(names = {"--net", "-n"}, help = true, description = "Connect to net [0-4]. 0 means mainnet, 1 - 1st testnet and so on") | ||
| @Option(names = {"--net", "-n"}, help = true, description = "Connect to net [0-4]. 0 means mainnet, 1 - 1st testnet and so on") | ||
| public int netIdx = -1; | ||
| @Parameter(names = {"--chain", "-C"}, help = true, description = "Connect to net with given chainID. UUID of chain id may be specified partially, 6 symbos min. Configs must be present.") | ||
| @Option(names = {"--chain", "-C"}, help = true, description = "Connect to net with given chainID. UUID of chain id may be specified partially, 6 symbols min. Config file must be present.") | ||
| public String chainId = ""; | ||
| @Parameter(names = {"--testnet"}, help = true, description = "Connect to testent 1. Has higher priority then --net") | ||
| @Option(names = {"--testnet"}, help = true, description = "Connect to testent 1. Has higher priority then --net") | ||
| public boolean isTestnet = false; | ||
| //--- | ||
| @Parameter(names = {"--disable-weld-concurrent-deployment"}, | ||
| description = "If use it, Weld doesn't use ConcurrentDeployer and ConcurrentValidator to build the container. Default value is true.") | ||
| @Option(names = {"--disable-weld-concurrent-deployment"}, defaultValue = "false", | ||
| description = "If use it, Weld doesn't use ConcurrentDeployer and ConcurrentValidator to build the container. Default value is ${DEFAULT-VALUE}.") | ||
| public boolean disableWeldConcurrentDeployment = false; | ||
|
|
||
| public boolean isResourceIgnored() { | ||
| return ingnoreResources; | ||
| return ignoreResources; | ||
| } | ||
|
|
||
| public int getNetIdx() { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.