Transcode cURL query to various programming languages
npm install curl_transcodeTranscode cURL query to various programming languages. The source directory that
contains source files .curl.sh. Transcoding put results into the target
directory. The source file name is keep unchange, the extension is changed to
specific programming language. There are programming supported languages and
platforms:
- cURL
- Rust
- Go
- C#
- Java
- Node.js
- Python
``bash`
npm install curl_transcode
mkdir source target
echo '{"replace": ["API_ENDPOINT"]}' > .curl_transcode.json
echo 'API_ENDPOINT="https://foo.bar/baz"' > .env
echo 'curl -X GET "$API_ENDPOINT"' > source/get.curl.sh
npx curl_transcode source target
`sh`
curl_transcode
- source_directory - Path to directory that contains source files .curl.sh.target_directory
It must be existed.
- - Path to directory to put result files. It must be
existed.
`jsonc
// File: ".curl_transcode.json".
// Support JSON5 format.
{
// List of tokens to replace by environment variable from source files
// .curl.sh.API_ENDPOINT
//
// Default: []
//
// Example: will replace token $API_ENDPOINT by value ofAPI_ENDPOINT
// environment variable .`
"replace": ["API_ENDPOINT"]
}
`bash.curl.shFile: ".env"
Contains environment variables for replacing source files
.``
API_ENDPOINT="https://foo.bar/baz