Skip to content

Module: add module desc subcommand#3700

Closed
shnwang wants to merge 1 commit intoredis:unstablefrom
shnwang:add_module_desc_sub_cmd
Closed

Module: add module desc subcommand#3700
shnwang wants to merge 1 commit intoredis:unstablefrom
shnwang:add_module_desc_sub_cmd

Conversation

@shnwang
Copy link
Contributor

@shnwang shnwang commented Dec 21, 2016

Redis has a lot of commands, users can use those commands to access
redis data.People get to know the commands by reading redis document
(https://redis.io/commands) .

Redis module is a wonderful feature which make it possible for user
to create custom commands.But when a module is loaded in redis, we
don't know what commands in the module, unless we have read the
module's source code or the module released with document.

A brief description about the module and the commands in the module
is needed.So the new module subcommand 'module desc' is very useful.
The module and its commands' brief description will be shown to
users by run 'module desc name'.

In order to make the module subcommand work properly, module developers
should provide the module description when call RedisModule_Init and
function description when call RedisModule_CreateCommand.

A new desc parameter added to RedisModule_Init,so the function changed
to:
int RedisModule_Init(RedisModuleCtx *ctx, const char *modulename,
const char *moduledesc,int module_version,
int api_version);

A new desc parameter added to RedisModule_CreateCommand, so the function
changed to:
int RedisModule_CreateCommand(RedisModuleCtx *ctx, const char *cmdname,
const char *cmddesc,RedisModuleCmdFunc cmdfunc);

Redis has a lot of commands, users can use those commands to access
redis data.People get to know the commands by reading redis document
(https://redis.io/commands) .

Redis module is a wonderful feature which make it possible for user
to create custom commands.But when a module is loaded in redis, we
don't know what commands in the module, unless we have read the
module's source code or the module released with document.

A brief description about the module and the commands in the module
is needed.So the new module subcommand 'module desc' is very useful.
The module and its commands' brief description will be shown to
users by run 'module desc name'.

In order to make the module subcommand work properly, module developers
should provide the module description when call RedisModule_Init and
function description when call  RedisModule_CreateCommand.

A new desc parameter added to RedisModule_Init,so the function changed
to:
    int RedisModule_Init(RedisModuleCtx *ctx, const char *modulename,
		         const char *moduledesc,int module_version,
		         int api_version);

A new desc parameter added to RedisModule_CreateCommand, so the function
changed to:
    int RedisModule_CreateCommand(RedisModuleCtx *ctx, const char *cmdname,
		          const char *cmddesc,RedisModuleCmdFunc cmdfunc);
@yossigo yossigo mentioned this pull request Dec 8, 2020
52 tasks
Comment on lines -121 to +122
int REDISMODULE_API_FUNC(RedisModule_CreateCommand)(RedisModuleCtx *ctx, const char *name, RedisModuleCmdFunc cmdfunc, const char *strflags, int firstkey, int lastkey, int keystep);
int REDISMODULE_API_FUNC(RedisModule_SetModuleAttribs)(RedisModuleCtx *ctx, const char *name, int ver, int apiver);
int REDISMODULE_API_FUNC(RedisModule_CreateCommand)(RedisModuleCtx *ctx, const char *name, const char *desc, RedisModuleCmdFunc cmdfunc, const char *strflags, int firstkey, int lastkey, int keystep);
int REDISMODULE_API_FUNC(RedisModule_SetModuleAttribs)(RedisModuleCtx *ctx, const char *name, const char *desc, int ver, int apiver);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not backwards compatible, unfortunately.

It would need to be a separate function like RedisModule_SetDesc(name, desc) or maybe a mechanism like RedisModule_RegisterInfoFunc could be used for providing help texts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 years past, things changed. I will change it .

@yoav-steinberg
Copy link
Contributor

I think this is obsoleted by #10108.

@yoav-steinberg yoav-steinberg added the state:to-be-closed requesting the core team to close the issue label Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:to-be-closed requesting the core team to close the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants