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.
The provided code changes introduce several modifications to the
arkd
command-line interface, primarily focusing on refactoring and improving the handling of flags and paths for macaroons and TLS certificates. Here's a summary of the key changes:Flag Refactoring:
"url"
is nowflagURL
, and"password"
is nowflagPassword
.New Function for Credential Paths:
getCredentialPaths(ctx *cli.Context)
is introduced. This function centralizes the logic for determining the paths of macaroons and TLS certificates.Simplification of Command Actions:
walletStatusAction
,walletCreateOrRestoreAction
,walletUnlockAction
,walletAddressAction
,walletBalanceAction
, andcreateNoteAction
) now use thegetCredentialPaths
function to fetch the macaroon and TLS certificate paths, reducing repetitive code.Removal of Unused Flags:
noMacaroonFlag
,macaroonFlag
, andtlsCertFlag
) have been removed. Instead, a singledatadirFlag
is used to specify the directory containing these files.Use of Path Joining for File Paths:
filepath.Join
function is used to construct file paths for macaroons and TLS certificates, ensuring cross-platform compatibility and correctness of file paths.Code Organization:
Overall, these changes aim to streamline the configuration and execution of commands by centralizing the handling of credentials and using a more structured approach to defining and using flags. This refactoring should improve both the maintainability of the code and the user experience when interacting with the command-line interface.
@altafan please review.