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

Rewrite macro 'with-curl-easy' #9

Merged
merged 1 commit into from
Mar 15, 2025
Merged

Rewrite macro 'with-curl-easy' #9

merged 1 commit into from
Mar 15, 2025

Conversation

fraya
Copy link
Owner

@fraya fraya commented Mar 15, 2025

Use a variable to initialize the curl handler, instead of creating the class inside the macro. This allows to subclass <curl-easy>.

with-curl-easy(curl = make(<curl-easy>))
  curl.curl-url := "http://example.com";
  curl.curl-verbose := #f;
  curl-easy-perform(curl);
end;

Now is possible to pass options to the macro. It makes less verbose the code.

with-curl-easy(curl = make(<curl-easy>),
               url = "http://example.com",
               verbose = #f)
  curl-easy-perform(curl)
end;

Closes #8

Use a variable to initialize the curl handler, instead of
creating the class inside the macro. This allows to subclass
`<curl-easy>`.

  with-curl-easy(curl = make(<curl-easy>))
    curl.curl-url := "http://example.com";
    curl.curl-verbose := #f;
    curl-easy-perform(curl);
  end;

Now is possible to pass options to the macro. It makes less verbose
the code.

  with-curl-easy(curl = make(<curl-easy>),
                 url = "http://example.com",
                 verbose = #f)
    curl-easy-perform(curl)
  end;

Closes #8
@fraya fraya merged commit af3d3b2 into main Mar 15, 2025
1 check passed
@fraya fraya deleted the fraya/with-curl/macro branch March 15, 2025 18:53
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.

Rewrite 'with-curl-easy' macro
1 participant