]> scripts.mit.edu Git - wizard.git/blob - wizard/command/quota.py
Use CLI installer for MediaWiki 1.17.0 and later.
[wizard.git] / wizard / command / quota.py
1 import logging
2 import os.path
3 import sys
4
5 from wizard import command, user
6
7 def main(argv, baton):
8     options, args = parse_args(argv, baton)
9     dir = os.path.abspath(args[0]) if args else os.getcwd()
10     r = user.quota(dir)
11     if r is None:
12         sys.exit(1)
13     print "%d %d" % r
14
15 def parse_args(argv, baton):
16     usage = """usage: %prog quota [DIR]
17
18 Lists the used quota in bytes for a directory.  If
19 a directory is not specified, uses the current working
20 directory.
21
22 Output format is:
23
24     USED AVAIL
25
26 in bytes.  Returns an exit code of 1 if quota could
27 not be determined."""
28     parser = command.WizardOptionParser(usage)
29     options, args = parser.parse_all(argv)
30     if len(args) > 1:
31         parser.error("too many arguments")
32     return options, args
33