Commit a9a8fa60 authored by Fardale's avatar Fardale

passage à argparse

parent 4fed7be7
......@@ -11,6 +11,7 @@ import json
import dump
import config
import threading, time, smtplib
import argparse
from email.mime.text import MIMEText
from config import DEVICE
......@@ -75,7 +76,12 @@ def checkPaper():
messageCourant, messagePapier = checkPrinter(False, messageCourant, messagePapier)
if __name__ == "__main__":
if '-fg' in sys.argv:
# Parse argument with argparse
parser = argparse.ArgumentParser()
parser.add_argument("-fg", help="run the daemon in forground mode", action="store_true")
args = parser.parse_args()
if args.fg:
thHasPaper = threading.Thread(target = checkPaper, name = 'checkPaper')
thHasPaper.start()
run()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment