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
|
import osc.commandline
class SimpleCommand(osc.commandline.OscCommand):
"""
A command that does nothing
More description
of what the command does.
"""
# command name
name = "simple"
# options and positional arguments
def init_arguments(self):
self.add_argument(
"--bool-option",
action="store_true",
help="...",
)
self.add_argument(
"arguments",
metavar="arg",
nargs="+",
help="...",
)
# code of the command
def run(self, args):
print(f"Bool option is {args.bool_option}")
print(f"Positional arguments are {args.arguments}")
|