Skip to content
suit Documentation
Login

Documentation

#ifndef SUIT_COMMANDS_H
#define SUIT_COMMANDS_H

#include "assets.h"
#include "conf.h"
#include "resolve.h"

#include <stddef.h>

// Placing takes every wardrobe under $SUIT_HOME/store that holds a suit.conf,
// merged into one set (src/wardrobes.h).

// Each returns an exit code and reports on stdout and stderr.
int cmd_plan(void);
int cmd_apply(void);
int cmd_status(void);
// Every place that supplies the asset NAME for the current folder, and which one is in effect.
int cmd_why(const char *name);
int cmd_off(void);
// `suit hooks`: what `suit-run hook EVENT` would run for each event, changing nothing.
int cmd_hooks(void);
// Say whether each need is done: 0 when all are, 1 when one is not or cannot be told, 2 on a config error.
int cmd_needs(void);
// Print the prompt of the need NAME of HARNESS.
int cmd_need(const char *harness, const char *name);
int cmd_run(void);
// `suit check` with no file: the canonical dump of every wardrobe's config as one set, or the first error (exit 2).
int cmd_check_set(void);
// NAME is null to show the machine's name.
int cmd_machine(const char *name);
// VERB is null to list the roots, else "add" or "rm" with ARG the folder. ARG is changed.
int cmd_roots(const char *verb, char *arg);
// Show the list the last scan wrote, or with SCAN make it.
int cmd_projects(bool scan);
// Set (KEY given) or unset the remote key of the project at PATH by hand. PATH is changed.
int cmd_project(char *path, const char *key);

// For `suit curate apply` (src/curate_apply.c): $SUIT_HOME and the lock file's path, each into
// a buffer of COMMANDS_PATH_CAP bytes. 1 after a message.
constexpr size_t COMMANDS_PATH_CAP = 4096;
int commands_home(char *suit_home, char *lock_path);

// The placements of the User and Project personal scopes that the config C, a set other than the
// one on disk, would give for the wardrobes W and the assets A, for this machine and the projects
// of the last scan. 1 after a message.
int commands_resolve(const Conf *c, const Wards *w, const Assets *a, Plan *out);

#endif