Command Line Interface

From Zaparoo Wiki

Revision as of 00:10, 30 November 2024 by Wizzo (talk | contribs) (Text replacement - "Zaparoo (Software)" to "Zaparoo Core")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

All Zaparoo core distributions ship with a common command line interface (CLI) that can be used to interact with the API. This interface is the same on every platform that Zaparoo works on, and can be safely used as a scripting target.

The name of the Zaparoo core binary may differ slightly between platforms. The examples on this page will target MiSTer which ships with a binary named tapto.sh, whereas Windows ships with a binary named Zaparoo.exe. Functionally they're the same, just replace the filename in the examples.

If a platform's binary displays a GUI when run without arguments, the GUI will not be display when at least one of these flags are enabled.

Help

  • Flag: -help
  • Argument: none (boolean switch)
  • Example: ./tapto.sh -helpThe most important one. This will output a list of all available command line flags along with a brief summary of each.

Version

  • Flag: -version
  • Argument: none (boolean switch)
  • Example: ./tapto.sh -version

Outputs this Zaparoo binary's build version (not the currently started API service).

API Request

  • Flag: -api
  • Argument: string
  • Example: ./tapto.sh -api 'launch:{"text":"**launch.system:menu"}'

Sends a single request to the Zaparoo API, waits for a response and then outputs the result body of that response.

Launch

  • Flag: -launch
  • Argument: string
  • Example: ./tapto.sh -launch "**launch.random:arcade"

Sends the string argument to the API as a launch command, as if a token with that text on it was scanned.

Write

  • Flag: -write
  • Argument: string
  • Example: ./tapto.sh -write "SNES/MyGame.sfc"

If a reader is physically connected to the device and has the capability to write to a token, try to write the given string to that token. Reports an error if the token couldn't be written and times out after 30 seconds.