-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
25 lines (22 loc) · 797 Bytes
/
example.py
File metadata and controls
25 lines (22 loc) · 797 Bytes
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
from minicli import command
def a_function(positional1, a_float: float, *args, keyword_only, kwarg='blarg'):
"""
A description of the command
Arguments:
positional1 (integer): the first positional argument
a_float (float): e.g. 1.5
*args: any number of other arguments
keyword_only: non-optional -- argument (a number)
kwarg: an option
"""
print("Hello!")
print('I recieved positional: ', positional1)
print("I converted this for you:", a_float, type(a_float))
print('required keyword: ', keyword_only)
print('other positionals: ', *args)
print('my options are: ', kwarg)
return
command(a_function)
# should have usage, followed by docstring as help
# all positionals should be passed in order
# all options as keywords