introduce a bit of regexp support in the internal CLI api.

Now you can specify a cli command as
	"console autoanswer [on|off]"

which means the on|off argument is optional, or

	"console {mute|unmute}"

which means the mute|unmute argument is mandatory.

The blocks in [] or {} do not necessarily need to be at the
end of the string.

Completions for the variant parts are generated automatically.
This should significantly simplify the implementation of
the various handlers.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47787 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2006-11-17 11:12:13 +00:00
parent 57d4919427
commit 867e3d6e5d
2 changed files with 173 additions and 86 deletions

View File

@@ -174,7 +174,7 @@ struct ast_cli_entry {
int inuse; /*!< For keeping track of usage */
struct module *module; /*!< module this belongs to */
char *_full_cmd; /*!< built at load time from cmda[] */
int cmdlen; /*!< len up to the first invalid char [<{% */
/*! \brief This gets set in ast_cli_register()
It then gets set to something different when the deprecated command
is run for the first time (ie; after we warn the user that it's deprecated)