forked from aroumie1997/duckietown-shell-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
command.py.template
38 lines (33 loc) · 1.44 KB
/
command.py.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from dt_shell import DTCommandAbs, dtslogger, DTShell
class DTCommand(DTCommandAbs):
help = 'Brief description of the command' # please redefine this help message
# name = <read-only> a string with the name of the command
# level = <read-only> integer indicating the level of this command. Follows directory hierarchy
# commands = <read-only> a dictionary of subcommands
@staticmethod
def command(shell: DTShell, args):
# this function will be invoked when the user presses [Return] and runs the command
#
# shell is the instance of DTShell hosting this command
# args is a list of arguments passed to the command
#
# PUT YOUR CODE HERE
print(
'You called the "%s" command, level %d, with arguments %r' % (
DTCommand.name,
DTCommand.level,
args
)
)
@staticmethod
def complete(shell, word, line):
# this function will be invoked when the user presses the [Tab] key for auto completion.
#
# shell is the instance of DTShell hosting this command
# word is the right-most word typed in the terminal
# (usually the string the user is trying to auto-complete)
#
# return a list of strings. Each string is a suggestion for the user
#
# PUT YOUR CODE HERE
return ['suggestion_1', 'suggestion_2']