diff --git a/surveillance/fiche_deconnection/generate.py b/surveillance/fiche_deconnection/generate.py index 93b77c67..c3bf44e6 100755 --- a/surveillance/fiche_deconnection/generate.py +++ b/surveillance/fiche_deconnection/generate.py @@ -77,6 +77,13 @@ def generate_ps(sanction, proprio, db): if __name__ == "__main__": + def aide(): + print help + sys.exit(0) + + if '--help' in sys.argv or '-h' in sys.argv: + aide() + db = crans_ldap() sanction = '' @@ -86,13 +93,11 @@ if __name__ == "__main__": if not sanction : print "Erreur : aucune sanction définie.\n" - print help - sys.exit(0) + aide() if len(sys.argv) <= 2 : print "Erreur : aucun motif de recherche défini.\n" - print help - sys.exit(0) + aide() else : motif = sys.argv[2] @@ -100,12 +105,10 @@ if __name__ == "__main__": if len(recherche) == 0: print "Erreur : aucun résultat pour %s.\n" % motif - print help - sys.exit(0) + aide() elif len(recherche) != 1: print "Erreur : plusieurs résultats pour %s.\n" % motif - print help - sys.exit(0) + aide() else : adherent = recherche[0]