2024-02-15 19:42:22 +01:00
|
|
|
#pragma once
|
|
|
|
|
2024-02-16 16:53:02 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const char* name;
|
|
|
|
const char* args;
|
|
|
|
const char* description;
|
|
|
|
} Command;
|
|
|
|
|
|
|
|
Command COMMANDS[] = {
|
|
|
|
{"help", "[command]", "Shows help for all or a specific command."},
|
|
|
|
{"version", NULL, "Shows the version of the program."},
|
|
|
|
{NULL, NULL, NULL},
|
|
|
|
{"add-entry", "<entry> [--root|-r <size>] [--backing|-b <backing>]", "Adds a new entry to the pool"},
|
|
|
|
{"remove-entry", "<entry>", "Removes an entry from the pool"},
|
|
|
|
{"list-entries", NULL, "Lists all entries in the pool"},
|
|
|
|
{"clear-entries", NULL, "Clears all entries from the pool"},
|
|
|
|
{NULL, NULL, NULL},
|
|
|
|
{"add-backing", "<entry>", "Adds a backing disk to the pool from the given entry"},
|
|
|
|
{"remove-backing", "<backing>", "Removes a backing disk from the pool"},
|
|
|
|
{"list-backings", "[--tree|-t]", "Lists all backing disks in the pool"},
|
|
|
|
{"clear-backings", NULL, "Clears all backing disks from the pool"},
|
|
|
|
{NULL, NULL, NULL},
|
|
|
|
{"start", "<entry> [--no-pci] [--vnc <port> <password>] [--iso <iso>]", "Starts the sandbox with the given entry"},
|
|
|
|
{"power", NULL, "Sends a power signal to the sandbox"},
|
|
|
|
{"stop", "[--force|-f] [--timeout|-t <timeout>]", "Stops the sandbox"},
|
|
|
|
{"status", NULL, "Shows the status of the sandbox"},
|
|
|
|
};
|
|
|
|
|
2024-02-16 02:22:24 +01:00
|
|
|
int main(int argc, char* argv[]);
|
2024-02-16 16:53:02 +01:00
|
|
|
|
|
|
|
/// @brief Finds the best matching command for the given command name.
|
|
|
|
/// @param name The name of the command to find.
|
|
|
|
/// @return The best matching command or NULL if no or multiple matches were found. No need to free the result.
|
|
|
|
Command* find_command(const char* name);
|