diff options
Diffstat (limited to 'src/cli/README.md')
-rw-r--r-- | src/cli/README.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cli/README.md b/src/cli/README.md index eefd2ff27..26f11d90a 100644 --- a/src/cli/README.md +++ b/src/cli/README.md @@ -1,3 +1,22 @@ # cli A git-compatible command-line interface that uses libgit2. + +## Adding commands + +1. Individual commands have a `main`-like top-level entrypoint. For example: + + ```c + int cmd_help(int argc, char **argv) + ``` + + Although this is the same signature as `main`, commands are not built as + individual standalone executables, they'll be linked into the main cli. + (Though there may be an option for command executables to be built as + standalone executables in the future.) + +2. Commands are prototyped in `cmd.h` and added to `main.c`'s list of + commands (`cli_cmds[]`). Commands should be specified with their name, + entrypoint and a brief description that can be printed in `git help`. + This is done because commands are linked into the main cli. + |