Skip to content

Commit

Permalink
Add version output
Browse files Browse the repository at this point in the history
  • Loading branch information
hevp committed Oct 30, 2019
1 parent 38bef93 commit d0fc5b5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dav.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from lxml import etree
from requests.packages.urllib3.exceptions import InsecureRequestWarning

TITLE = "CompactDAV"
VERSION = "v1.0"

class ChunkedFile(object):
""" Chunked file upload class to be used with requests package """
Expand Down Expand Up @@ -625,11 +627,15 @@ def printSummary(self, listing):
def makeHuman(self, value, addBytes=False):
return humanize.naturalsize(value) if self.options['human'] else "%d%s" % (value, " bytes" if addBytes else "")

def version():
print("%s %s" % (TITLE, VERSION))

def usage():
print("usage: dav.py <operation> <options> <args..>")

def help(wd, operation, options, defaults):
if operation == "" or operation not in wd.api.keys():
version()
usage()

# get maximum length of name of operation
Expand Down Expand Up @@ -708,7 +714,7 @@ def main(argv):
help(wd, operation, quickopts, common.defaults)
sys.exit(0)
elif common.options['version']:
print("%s %s" % (TITLE, VERSION))
version()
sys.exit(0)

# check operation
Expand Down

0 comments on commit d0fc5b5

Please sign in to comment.