This topic presents a top-level view of how to add a command to your vShell instance.
from vsh import
statement.
# Import Python functions from the vsh module from vsh import output, cmdparser
# Define the function that the command will call. def hello(username): output("Hello %s, how are you doing?", username)
# cmdparser(<target-function>, <syntax>, <msg>) cmdparser(hello, "hello:%s", "Say hello to someone")
~/.vsh
directory.
bash$ cp demo.py ~/.vsh
$ vsh For help anytime, type '?' When you're done, type '^D' (vsh)
(vsh) ? clear Clear connect Connect console create Provisioning hello Say hello to someone delete Destroy exit Exit shell help Get help list Show running devices poweroff Power off device poweron Power on device show Show info start Power on and connect system Bridge daemon control
(vsh) hello Mark Hello Mark, how are you doing?
Note
The command you created will load every time you log in to this instance of vShell.