mirror of
https://github.com/kennethreitz-archive/plac.git
synced 2026-06-05 15:40:17 +00:00
16 lines
412 B
Python
16 lines
412 B
Python
# example4.py
|
|
from datetime import datetime
|
|
|
|
def main(dsn, table='product', today=datetime.today()):
|
|
"Do something on the database"
|
|
print(dsn, table, today)
|
|
|
|
if __name__ == '__main__':
|
|
import sys
|
|
args = sys.argv[1:]
|
|
if not args:
|
|
sys.exit('usage: python %s dsn' % sys.argv[0])
|
|
elif len(args) > 2:
|
|
sys.exit('Unrecognized arguments: %s' % ' '.join(argv[2:]))
|
|
main(*args)
|