Skip to content
Snippets Groups Projects
Commit e298f4de authored by alexey.stratulat's avatar alexey.stratulat
Browse files

[+] Added an example plugin that adds commands.

parent 5bf9b63c
No related branches found
No related tags found
1 merge request!82hotfix handler cli command
from API_CellFrame import logItNotice, AppCliServer
"""
This function takes two arguments
argv is an array of incoming arguments
indexStrReply is an internal index that correlates what is needed
to fill the desired buffer with the data that will be passed to the CLI.
"""
def cmdDemo(argv, indexStrReply):
reply = "Arguments :\n"
for i in range(len(argv)):
reply += "arg["+str(i)+"]: "+argv[i]+"\n"
AppCliServer.setReplyText(reply, indexStrReply)
def cmdDemo2(argv, indexStrReply):
AppCliServer.setReplyText("I simple demo command", indexStrReply)
def init():
logItNotice("Running plugin order")
"""
The cmdItemCreate function creates a CLI command.
This function takes four arguments.
Command name, command handler function, short description of
of the command, full description of the command.
"""
AppCliServer.cmdItemCreate("demo", cmdDemo, "Command demo",
"""
This command is intended to demonstrate the work of custom command in the CellFrame API for Python.
""")
AppCliServer.cmdItemCreate("demo2", cmdDemo2, "Second command demo",
"""
This is demo and testing
""")
return 0
{
"name": "demoCustomCMD",
"version": "1.0",
"author": "DEMLABS (C) 2022",
"dependencys": [],
"description": "This is a plugin example for working custom command."
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment