aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index ebd9f7f3ff..fc1826975a 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -12,6 +12,8 @@
#include <string.h>
#include <stdbool.h>
+#include <msgpack.h>
+
#include "nvim/ascii.h"
#include "nvim/vim.h"
#include "nvim/main.h"
@@ -57,6 +59,9 @@
#include "nvim/os/input.h"
#include "nvim/os/os.h"
#include "nvim/os/signal.h"
+#include "nvim/os/msgpack_rpc_helpers.h"
+#include "nvim/api/private/defs.h"
+#include "nvim/api/private/helpers.h"
/* Maximum number of commands from + or -c arguments. */
#define MAX_ARG_CMDS 10
@@ -116,9 +121,6 @@ static void init_locale(void);
# endif
#endif /* NO_VIM_MAIN */
-extern const uint8_t msgpack_metadata[];
-extern const unsigned int msgpack_metadata_size;
-
/*
* Different types of error messages.
*/
@@ -1026,12 +1028,18 @@ static void command_line_scan(mparm_T *parmp)
msg_putchar('\n');
msg_didout = FALSE;
mch_exit(0);
- } else if (STRICMP(argv[0] + argv_idx, "api-msgpack-metadata") == 0) {
- for (unsigned int i = 0; i<msgpack_metadata_size; i++) {
- putchar(msgpack_metadata[i]);
+ } else if (STRICMP(argv[0] + argv_idx, "api-info") == 0) {
+ msgpack_sbuffer* b = msgpack_sbuffer_new();
+ msgpack_packer* p = msgpack_packer_new(b, msgpack_sbuffer_write);
+ Object md = DICTIONARY_OBJ(api_metadata());
+ msgpack_rpc_from_object(md, p);
+
+ for (size_t i = 0; i < b->size; i++) {
+ putchar(b->data[i]);
}
+
mch_exit(0);
- } else if (STRICMP(argv[0] + argv_idx, "embedded-mode") == 0) {
+ } else if (STRICMP(argv[0] + argv_idx, "embed") == 0) {
embedded_mode = true;
} else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0) {
#if !defined(UNIX)
@@ -2212,8 +2220,8 @@ static void usage(void)
main_msg(_("-W <scriptout>\tWrite all typed commands to file <scriptout>"));
main_msg(_("--startuptime <file>\tWrite startup timing messages to <file>"));
main_msg(_("-i <viminfo>\t\tUse <viminfo> instead of .viminfo"));
- main_msg(_("--api-msgpack-metadata\tDump API metadata information and exit"));
- main_msg(_("--embedded-mode\tUse stdin/stdout as a msgpack-rpc channel. "
+ main_msg(_("--api-info\t\tDump API metadata serialized to msgpack and exit"));
+ main_msg(_("--embed\t\tUse stdin/stdout as a msgpack-rpc channel. "
"This can be used for embedding Neovim into other programs"));
main_msg(_("-h or --help\tPrint Help (this message) and exit"));
main_msg(_("--version\t\tPrint version information and exit"));