feat: add --dry-run flag to all 47 CLI tools
When --dry-run is passed, each CLI prints the HTTP request it would make (method, URL, headers, body) without actually calling fetch(). Auth credentials are masked as "***" in the output. Useful for verifying request shape and API endpoints without needing real API keys or making actual API calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,11 @@ function parseCSV(text) {
|
||||
async function api(params) {
|
||||
params.set('key', API_KEY)
|
||||
params.set('export_escape', '1')
|
||||
if (args['dry-run']) {
|
||||
const maskedParams = new URLSearchParams(params)
|
||||
maskedParams.set('key', '***')
|
||||
return { _dry_run: true, method: 'GET', url: `${BASE_URL}?${maskedParams}`, headers: {}, body: undefined }
|
||||
}
|
||||
const res = await fetch(`${BASE_URL}?${params}`)
|
||||
const text = await res.text()
|
||||
if (!res.ok) {
|
||||
|
||||
Reference in New Issue
Block a user