Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Aliases

Yuri Schimke edited this page Jul 18, 2018 · 7 revisions

Aliases

Existing

OkUrl support defining short aliases, and comes with some by default e.g.

Format

The format for these files is generally

#!/usr/bin/env ./okapi

"https://api.twitter.com" + item

Variables

  • client (okhttp3.Client)

  • clientBuilder (okhttp3.Client.Builder)

  • requestBuilder (okhttp3.Request.Builder)

  • item (String argument from command line)

  • arguments (String[] in -m mode)

Return Values

  • String (URI)
  • okhttp3.Request
  • iterable of String/Request

Alternative Alias format

with -m, your alias script will receive all arguments and can do option parsing or use 3 arguments to build a single request

#!/usr/bin/env okapi -m

"https://api.twitter.com/1.1/search/tweets.json?q=" + arguments[0] + "&count=" + arguments[1]
$ ./commands/tweetsearch test 1 | jq .statuses[].text
"RT @somebody: bio test tomorrow 🙃"
Clone this wiki locally