futriix/src/cli_commands.h
Ping Xie c41dd77a3e
Add clang-format configs (#323)
I have validated that these settings closely match the existing coding
style with one major exception on `BreakBeforeBraces`, which will be
`Attach` going forward. The mixed `BreakBeforeBraces` styles in the
current codebase are hard to imitate and also very odd IMHO - see below

```
if (a == 1) { /*Attach */
}
```

```
if (a == 1 ||
    b == 2)
{ /* Why? */
}
```

Please do NOT merge just yet. Will add the github action next once the
style is reviewed/approved.

---------

Signed-off-by: Ping Xie <pingxie@google.com>
2024-05-22 23:24:12 -07:00

47 lines
1.4 KiB
C

/* This file is used by valkey-cli in place of server.h when including commands.c
* It contains alternative structs which omit the parts of the commands table
* that are not suitable for valkey-cli, e.g. the command proc. */
#ifndef VALKEY_CLI_COMMANDS_H
#define VALKEY_CLI_COMMANDS_H
#include <stddef.h>
#include "commands.h"
/* Syntax specifications for a command argument. */
typedef struct cliCommandArg {
char *name;
serverCommandArgType type;
char *token;
char *since;
int flags;
int numsubargs;
struct cliCommandArg *subargs;
const char *display_text;
/*
* For use at runtime.
* Fields used to keep track of input word matches for command-line hinting.
*/
int matched; /* How many input words have been matched by this argument? */
int matched_token; /* Has the token been matched? */
int matched_name; /* Has the name been matched? */
int matched_all; /* Has the whole argument been consumed (no hint needed)? */
} cliCommandArg;
/* Command documentation info used for help output */
struct commandDocs {
char *name;
char *summary;
char *group;
char *since;
int numargs;
cliCommandArg *args; /* An array of the command arguments. */
struct commandDocs *subcommands;
char *params; /* A string describing the syntax of the command arguments. */
};
extern struct commandDocs serverCommandTable[];
#endif