Developer Documentation
Our new developer documentation is now available. Please check it out!

CLI Tool

ODIN Fleet provides a simple to ease CLI tool that allows you to interact with ODIN Fleet from your command line. It’s open-source and written in Deno and uses the TypeScript ODIN SDK internally.

Source Code

The CLI tool is open-source and available on GitHub. You can find the source code in the following repository: https://github.com/4Players/fleet-cli.

Installation

To install the CLI tool, you need to have Deno installed. You can install Deno by following the instructions on the official Deno website: https://deno.land/.

Next, run the following command to generate the CLI tool:

deno task build

This will build a odin binary (or odin.exe on Windows) in the root of the project. You can move this binary to a directory in your PATH to use it globally. On macOS and Linux you might need to run the following command to make the binary executable:

chmod +x odin

Development

You need to have npm installed on your system. You can install it by following the instructions on the official npm website: https://www.npmjs.com/get-npm.

If you want to work on the CLI tool, you can need to have openapi-generator-cli installed on your system. You can install it by running the following command:

npm install @openapitools/openapi-generator-cli -g

On Mac you can also use Homebrew to install the openapi-generator-cli.

openapi-generator-cli version-manager set 7.3.0

Updating the underlying SDK

To update the underlying SDK, you need to run the following command to make the script executable (if not done before):

chmod +x generate-sdk.sh

Then run the script to generate the SDK:

./generate-sdk.sh

This will generate the SDK from the OpenAPI specification file. The generated SDK will be placed in the src/api directory. The CLI tool uses this SDK to interact with the ODIN APIs.

Testing the CLI tool

To run the CLI tool in development mode, you can run the following command:

deno run --allow-all src/main.ts

We use --allow-all because the CLI tool needs to access various system resources to work correctly:

  • --allow-read to read the configuration file
  • --allow-write to write the configuration file
  • --allow-net to make API requests
  • --allow-env to read environment variables

Building the CLI tool

To build the CLI tool, you can run the following command:

deno task build

This will create a binary executable (i.e. odin on macOS and odin.exe on Windows) in the root of the project. You can move this binary to a directory in your PATH to use it globally.