docs: Minor usage cleanup.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
This commit is contained in:
66
src/main.c
66
src/main.c
@ -169,8 +169,8 @@ typedef struct _command_t
|
||||
const command_t k_commands[] = {
|
||||
{ "run", _tf_command_run, "Run tildefriends (default)." },
|
||||
{ "sandbox", _tf_command_sandbox, "Run a sandboxed tildefriends sandbox process (used internally)." },
|
||||
{ "import", _tf_command_import, "Import apps to SSB." },
|
||||
{ "export", _tf_command_export, "Export apps from SSB." },
|
||||
{ "import", _tf_command_import, "Import apps from file to the database." },
|
||||
{ "export", _tf_command_export, "Export apps from the database to file." },
|
||||
{ "publish", _tf_command_publish, "Append a message to a feed." },
|
||||
{ "private", _tf_command_private, "Append a private post message to a feed." },
|
||||
{ "create_invite", _tf_command_create_invite, "Create an invite." },
|
||||
@ -185,6 +185,18 @@ const command_t k_commands[] = {
|
||||
{ "test", _tf_command_test, "Test SSB." },
|
||||
};
|
||||
|
||||
static const char* _description(const char* name)
|
||||
{
|
||||
for (int i = 0; i < tf_countof(k_commands); i++)
|
||||
{
|
||||
if (strcmp(name, k_commands[i].name) == 0)
|
||||
{
|
||||
return k_commands[i].description;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int _tf_command_test(const char* file, int argc, char* argv[])
|
||||
{
|
||||
#if !defined(__ANDROID__)
|
||||
@ -233,8 +245,9 @@ static int _tf_command_test(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage)
|
||||
{
|
||||
tf_printf("\n%s test [options]\n\n", file);
|
||||
tf_printf("options\n");
|
||||
tf_printf("\nUsage: %s test [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("test"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -t, --tests tests Comma-separated list of tests to run. (default: all)\n");
|
||||
tf_printf(" -h, --help Show this usage information.\n");
|
||||
tf_free((void*)default_db_path);
|
||||
@ -288,7 +301,8 @@ static int _tf_command_import(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage)
|
||||
{
|
||||
tf_printf("\n%s import [options] [paths...]\n\n", file);
|
||||
tf_printf("\nUsage: %s import [options] [paths...]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("import"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -u, --user user User into whose account apps will be imported (default: \"import\").\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
@ -357,7 +371,8 @@ static int _tf_command_export(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage)
|
||||
{
|
||||
tf_printf("\n%s export [options] [paths...]\n\n", file);
|
||||
tf_printf("\nUsage: %s export [options] [paths...]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("export"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -u, --user user User from whose account apps will be exported (default: \"core\").\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
@ -473,7 +488,8 @@ static int _tf_command_publish(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage || !identity || !content)
|
||||
{
|
||||
tf_printf("\n%s publish [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s publish [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("publish"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -u, --user user User owning identity with which to publish.\n");
|
||||
tf_printf(" -i, --id identity Identity with which to publish message.\n");
|
||||
@ -592,7 +608,8 @@ static int _tf_command_private(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage || !identity || !recipients || !text)
|
||||
{
|
||||
tf_printf("\n%s private [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s private [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("private"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -u, --user user User owning identity with which to publish (optional).\n");
|
||||
tf_printf(" -i, --id identity Identity with which to publish message.\n");
|
||||
@ -723,7 +740,8 @@ static int _tf_command_store_blob(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage || !file_path)
|
||||
{
|
||||
tf_printf("\n%s store_blob [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s store_blob [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("store_blob"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
tf_printf(" -f, --file file_path Path to file to add to the blob store.\n");
|
||||
@ -825,7 +843,8 @@ static int _tf_command_get_blob(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage || !blob_id)
|
||||
{
|
||||
tf_printf("\n%s get_blob [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s get_blob [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("get_blob"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
tf_printf(" -b, --blob blob_id Blob identifier to retrieve.\n");
|
||||
@ -927,7 +946,8 @@ static int _tf_command_has_blob(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage || !blob_id)
|
||||
{
|
||||
tf_printf("\n%s has_blob [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s has_blob [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("has_blob"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
tf_printf(" -b, --blob_id blob_id ID of blob to query.\n");
|
||||
@ -1005,7 +1025,8 @@ static int _tf_command_create_invite(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage || !identity || !use_count || !expires || !host || !port)
|
||||
{
|
||||
tf_printf("\n%s create_invite [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s create_invite [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("create_invite"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
tf_printf(" -i, --identity identity Account from which to get latest sequence number.\n");
|
||||
@ -1073,7 +1094,8 @@ static int _tf_command_get_sequence(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage || !identity)
|
||||
{
|
||||
tf_printf("\n%s get_sequence [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s get_sequence [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("get_sequence"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
tf_printf(" -i, --identity identity Account from which to get latest sequence number.\n");
|
||||
@ -1126,7 +1148,8 @@ static int _tf_command_get_identity(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage)
|
||||
{
|
||||
tf_printf("\n%s get_identity [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s get_identity [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("get_identity"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
tf_printf(" -h, --help Show this usage information.\n");
|
||||
@ -1183,7 +1206,8 @@ static int _tf_command_get_profile(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage || !identity)
|
||||
{
|
||||
tf_printf("\n%s get_profile [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s get_profile [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("get_profile"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
tf_printf(" -i, --identity identity Account for which to get profile information.\n");
|
||||
@ -1242,7 +1266,8 @@ static int _tf_command_get_contacts(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage || !identity)
|
||||
{
|
||||
tf_printf("\n%s get_contacts [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s get_contacts [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("get_contacts"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
tf_printf(" -i, --identity identity Account from which to get contact information.\n");
|
||||
@ -1343,7 +1368,8 @@ static int _tf_command_verify(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage)
|
||||
{
|
||||
tf_printf("\n%s verify [options]\n\n", file);
|
||||
tf_printf("\nUsage: %s verify [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("verify"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -i, --identity identity Identity to verify.\n");
|
||||
tf_printf(" -s, --sequence sequence Sequence number to debug.\n");
|
||||
@ -1671,8 +1697,9 @@ static int _tf_command_run(const char* file, int argc, char* argv[])
|
||||
|
||||
if (show_usage)
|
||||
{
|
||||
tf_printf("\n%s run [options]\n\n", file);
|
||||
tf_printf("options\n");
|
||||
tf_printf("\nUsage: %s run [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("run"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -s, --script script Script to run (default: core/core.js).\n");
|
||||
tf_printf(" -d, --db-path path SQLite database path (default: %s).\n", default_db_path);
|
||||
tf_printf(" -k, --ssb-network-key key SSB network key to use.\n");
|
||||
@ -1757,6 +1784,7 @@ static int _tf_command_sandbox(const char* file, int argc, char* argv[])
|
||||
if (show_usage)
|
||||
{
|
||||
tf_printf("\nUsage: %s sandbox [options]\n\n", file);
|
||||
tf_printf("%s\n\n", _description("sandbox"));
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -h, --help Show this usage information.\n");
|
||||
tf_printf(" -f, --fd File descriptor with which to communicate with parent process.\n");
|
||||
|
Reference in New Issue
Block a user