This repository was archived by the owner on Aug 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* contact delete added * Modify contact delete behaviour * modify formatting for print key * Correct force functionality Make tests pass * Key list functionality added print_key modified * move export PYTHONPATH down * refine delete * changes for PEP8 some minor changes in contact list * preserve exit behavior on EOF * Make message simpler for the user. * address some stylistic issues
- Loading branch information
1 parent
8516640
commit a3a74de
Showing
10 changed files
with
102 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import gpg | ||
import sys | ||
import os | ||
from fn.print_key import print_key | ||
|
||
|
||
def delete(contacts, force): | ||
try: | ||
c = gpg.Context() | ||
for contact in contacts: | ||
keys = list(c.keylist(contact)) | ||
ans = "n" | ||
for key in keys: | ||
if not force: | ||
print_key(key.fpr, end="\n") | ||
try: | ||
ans = input("Delete this contact? (y/N)") | ||
except EOFError: | ||
exit(0) | ||
|
||
if ans.lower() == 'y' or force: | ||
c.op_delete(key, False) | ||
|
||
except BaseException: | ||
if os.environ['DEBUG'] == 'yes': | ||
raise | ||
exit(2) | ||
|
||
|
||
if __name__ == "__main__": | ||
force = int(sys.argv[1]) | ||
contacts = sys.argv[2:] | ||
delete(contacts, force) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import gpg | ||
import sys | ||
import os | ||
from fn.print_key import print_key | ||
|
||
|
||
def list_contacts(contacts): | ||
try: | ||
c = gpg.Context() | ||
|
||
key_set = set() | ||
|
||
for contact in contacts: | ||
key_set.update(c.keylist(contact)) | ||
|
||
if len(list(key_set)) == 0: | ||
print("No matching contacts found!") | ||
exit(0) | ||
|
||
for key in key_set: | ||
print_key(key.fpr, end="\n") | ||
|
||
except BaseException: | ||
if os.environ["DEBUG"] == 'yes': | ||
raise | ||
exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
contacts = [None] | ||
if len(sys.argv) > 1: | ||
contacts = sys.argv[1:] | ||
|
||
if os.environ['DEBUG'] == 'yes': | ||
print("contacts:", contacts, sep="\n") | ||
|
||
list_contacts(contacts) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.