Skip to content
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

Add argument support #11

Merged
merged 2 commits into from
Apr 23, 2023
Merged

Add argument support #11

merged 2 commits into from
Apr 23, 2023

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

Verified

This commit was signed with the committer’s verified signature.
wolf4ood Enrico Risa
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.

None yet

1 participant