Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python-cellframe
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
python-cellframe
Commits
e298f4de
Commit
e298f4de
authored
3 years ago
by
alexey.stratulat
Browse files
Options
Downloads
Patches
Plain Diff
[+] Added an example plugin that adds commands.
parent
5bf9b63c
No related branches found
No related tags found
1 merge request
!82
hotfix handler cli command
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dists/examples/plugins/demoCustomCMD/demoCustomCMD.py
+34
-0
34 additions, 0 deletions
dists/examples/plugins/demoCustomCMD/demoCustomCMD.py
dists/examples/plugins/demoCustomCMD/manifest.json
+8
-0
8 additions, 0 deletions
dists/examples/plugins/demoCustomCMD/manifest.json
with
42 additions
and
0 deletions
dists/examples/plugins/demoCustomCMD/demoCustomCMD.py
0 → 100644
+
34
−
0
View file @
e298f4de
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
This diff is collapsed.
Click to expand it.
dists/examples/plugins/demoCustomCMD/manifest.json
0 → 100644
+
8
−
0
View file @
e298f4de
{
"name"
:
"demoCustomCMD"
,
"version"
:
"1.0"
,
"author"
:
"DEMLABS (C) 2022"
,
"dependencys"
:
[],
"description"
:
"This is a plugin example for working custom command."
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment