diff --git a/dists/examples/plugins/demoCustomCMD/demoCustomCMD.py b/dists/examples/plugins/demoCustomCMD/demoCustomCMD.py new file mode 100644 index 0000000000000000000000000000000000000000..cd1eb93184466957efc054605ca7c8613d44f7bc --- /dev/null +++ b/dists/examples/plugins/demoCustomCMD/demoCustomCMD.py @@ -0,0 +1,34 @@ +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 diff --git a/dists/examples/plugins/demoCustomCMD/manifest.json b/dists/examples/plugins/demoCustomCMD/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..bf34c36336b6dea0c6e717989145cc0afb042263 --- /dev/null +++ b/dists/examples/plugins/demoCustomCMD/manifest.json @@ -0,0 +1,8 @@ +{ + "name": "demoCustomCMD", + "version": "1.0", + "author": "DEMLABS (C) 2022", + "dependencys": [], + "description": "This is a plugin example for working custom command." +} +