Skip to content

Add argument support#11

Merged
nvima merged 2 commits intomainfrom
feat-arg-support
Apr 23, 2023
Merged

Add argument support#11
nvima merged 2 commits intomainfrom
feat-arg-support

Conversation

@nvima
Copy link
Owner

@nvima nvima commented Apr 23, 2023

Implement Argument Support for httpcli Commands

This commit introduces the ability to pass arguments to httpcli commands,
allowing users to dynamically define values in their configuration files.
With this new feature, users can now provide arguments when invoking httpcli, such as:

httpcli functionname arg1 "arg2 is here" arg3

The changes include:

- Implementing a replaceArgs function that replaces placeholders, such as ${ARG1}, ${ARG2}, etc., in the URL and headers with the respective command line arguments.
- Refactoring the existing environment variable replacement logic into a separate replaceEnvVariables function for better code organization.
- Updating the getJSONData function to accept the new args parameter and call the replaceVariables function, which in turn calls both replaceArgs and replaceEnvVariables.
- Adding a new ReplaceArgs function in the util package to handle argument replacement within the input JSON data.
- Updating Readme

nvima added 2 commits April 23, 2023 19:03
This commit introduces the ability to pass arguments to httpcli commands,
allowing users to dynamically define values in their configuration files.
With this new feature, users can now provide arguments when invoking httpcli, such as:

httpcli functionname arg1 "arg2 is here" arg3

The changes include:

- Implementing a replaceArgs function that replaces placeholders, such as ${ARG1}, ${ARG2}, etc., in the URL and headers with the respective command line arguments.
- Refactoring the existing environment variable replacement logic into a separate replaceEnvVariables function for better code organization.
- Updating the getJSONData function to accept the new args parameter and call the replaceVariables function, which in turn calls both replaceArgs and replaceEnvVariables.
- Adding a new ReplaceArgs function in the util package to handle argument replacement within the input JSON data.
This commit adds documentation on how to pass dynamic values to API requests using command line arguments in the YAML configuration file.
The placeholders ${ARG1}, ${ARG2}, and so on, can be used to represent the command line arguments provided when invoking `httpcli`.
An example is provided showing how to use this feature with a translation API.
Additionally, the commit reorders the table of contents for better organization and readability.
@nvima nvima merged commit 3342088 into main Apr 23, 2023
@nvima nvima deleted the feat-arg-support branch April 23, 2023 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant