diff options
author | hploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b> | 2007-06-08 05:33:29 +0000 |
---|---|---|
committer | hploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b> | 2007-06-08 05:33:29 +0000 |
commit | 6916b45f114cf363eaef659914f6deb95dfa1a0b (patch) | |
tree | 24689ca313a0926213d0ffd718434d90824a3d36 /readpass.py | |
parent | 09ab2cbff7782533f595332c7fd3c16cfea76d48 (diff) |
Reading from and saving to filesets works
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@230 f711b948-2313-0410-aaa9-d29f33439f0b
Diffstat (limited to 'readpass.py')
-rwxr-xr-x | readpass.py | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/readpass.py b/readpass.py index b439b1f..1e36ba2 100755 --- a/readpass.py +++ b/readpass.py @@ -4,10 +4,12 @@ from utils import pycsc import utils, cards, TLV_utils, sys, binascii, time, traceback -OPTIONS = "G" -LONG_OPTIONS = ["no-gui"] +OPTIONS = "GW:R:" +LONG_OPTIONS = ["no-gui", "write-files-basename", "read-files-basename"] use_gui = True +write_files = None +read_files = None if __name__ == "__main__": c = utils.CommandLineArgumentHelper() @@ -17,19 +19,29 @@ if __name__ == "__main__": for option, value in options: if option in ("-G","--no-gui"): use_gui = False + elif option in ("-W","--write-files-basename"): + write_files = value + elif option in ("-R","--read-files-basename"): + read_files = value - pycsc_card = c.connect() - card = cards.new_card_object(pycsc_card) - cards.generic_card.DEBUG = False - - print >>sys.stderr, "Using %s" % card.DRIVER_NAME - - if len(arguments) > 1: - p = cards.passport_application.Passport.from_card(card, arguments[:2]) - elif len(arguments) == 1: - p = cards.passport_application.Passport.from_card(card, ["",arguments[0]]) + if read_files is None: + pycsc_card = c.connect() + card = cards.new_card_object(pycsc_card) + cards.generic_card.DEBUG = False + + print >>sys.stderr, "Using %s" % card.DRIVER_NAME + + if len(arguments) > 1: + p = cards.passport_application.Passport.from_card(card, arguments[:2]) + elif len(arguments) == 1: + p = cards.passport_application.Passport.from_card(card, ["",arguments[0]]) + else: + p = cards.passport_application.Passport.from_card(card) else: - p = cards.passport_application.Passport.from_card(card) + p = cards.passport_application.Passport.from_files(basename=read_files) + + if write_files is not None: + p.to_files(basename=write_files) if use_gui: import gui |