ajout d'un pass
This commit is contained in:
parent
14db724483
commit
52a1a1138f
1 changed files with 14 additions and 7 deletions
|
@ -252,14 +252,21 @@ def show_file(fname):
|
||||||
|
|
||||||
def edit_file(fname):
|
def edit_file(fname):
|
||||||
value = get_file(fname)
|
value = get_file(fname)
|
||||||
|
nfile = False
|
||||||
if value == False:
|
if value == False:
|
||||||
print "Fichier introuvable"; return
|
nfile = True
|
||||||
(sin,sout) = gpg('decrypt')
|
print "Fichier introuvable"
|
||||||
sin.write(value['contents'])
|
if not confirm("Créer fichier ?"):
|
||||||
sin.close()
|
return
|
||||||
texte = sout.read()
|
texte = ""
|
||||||
|
value = {'roles':get_my_roles()}
|
||||||
|
else:
|
||||||
|
(sin,sout) = gpg('decrypt')
|
||||||
|
sin.write(value['contents'])
|
||||||
|
sin.close()
|
||||||
|
texte = sout.read()
|
||||||
ntexte = editor(texte)
|
ntexte = editor(texte)
|
||||||
if ntexte == None:
|
if ntexte == None and not nfile and NROLES != None:
|
||||||
print "Pas de modifications effectuées"
|
print "Pas de modifications effectuées"
|
||||||
else:
|
else:
|
||||||
if put_password(fname,value['roles'],ntexte):
|
if put_password(fname,value['roles'],ntexte):
|
||||||
|
@ -346,7 +353,7 @@ if __name__ == "__main__":
|
||||||
action_grp = parser.add_mutually_exclusive_group(required=False)
|
action_grp = parser.add_mutually_exclusive_group(required=False)
|
||||||
action_grp.add_argument('--edit',action='store_const',dest='action',
|
action_grp.add_argument('--edit',action='store_const',dest='action',
|
||||||
default=show_file,const=edit_file,
|
default=show_file,const=edit_file,
|
||||||
help="Editer")
|
help="Editer (ou créer)")
|
||||||
action_grp.add_argument('--view',action='store_const',dest='action',
|
action_grp.add_argument('--view',action='store_const',dest='action',
|
||||||
default=show_file,const=show_file,
|
default=show_file,const=show_file,
|
||||||
help="Voir")
|
help="Voir")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue