Skip to content

Commit

Permalink
Add optional argument
Browse files Browse the repository at this point in the history
  • Loading branch information
kphaterp committed Nov 18, 2021
1 parent c53b3a4 commit f6ac719
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# author: Tiffany Timbersy
# date: 2020-01-15

"""This script prints out docopt args.
Usage: demo.py <arg1> --arg2=<arg2> [--arg3=<arg3>] [--arg4=<arg4>]
Options:
<arg> Takes any value (this is a required positional argument)
--arg2=<arg2> Takes any value (this is a required option)
[--arg3=<arg3>] Takes any value (this is an optional option)
[--arg4=<arg4>] Takes any value (this is an optional option)
"""

from docopt import docopt
opt = docopt(__doc__)
print(opt["--arg4"])
print(opt)
print(type(opt))

0 comments on commit f6ac719

Please sign in to comment.