From 9824f55b0a796566602819b461c1be90b069b206 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Mon, 1 Aug 2022 12:30:17 -0700 Subject: [PATCH] remove the old code that was replaced in the previous commit.. --- ui/medashare/cli.py | 73 --------------------------------------------- 1 file changed, 73 deletions(-) diff --git a/ui/medashare/cli.py b/ui/medashare/cli.py index fe872b6..ee39778 100644 --- a/ui/medashare/cli.py +++ b/ui/medashare/cli.py @@ -689,79 +689,6 @@ def main(): fun = options.func fun(options) - return - - # this is shared between generateident and add - addprops = [x.split('=', 1) for x in options.add] - - if any((len(x) != 2 for x in addprops)): - print('ERROR: invalid tag, needs an "=".', file=sys.stderr) - sys.exit(1) - - if options.updateident or options.printpub: - identfname = os.path.expanduser('~/.medashare_identity.pasn1') - - persona = Persona.load(identfname) - - if options.printpub: - print(persona.get_pubkey().decode('ascii')) - return - - persona.new_version(*addprops) - persona.store(identfname) - return - - storefname = os.path.expanduser('~/.medashare_store.pasn1') - identfname = os.path.expanduser('~/.medashare_identity.pasn1') - - try: - persona = Persona.load(identfname) - except FileNotFoundError: - print('ERROR: Identity not created, create w/ -g.', file=sys.stderr) - sys.exit(1) - - try: - objstr = ObjectStore.load(storefname) - except FileNotFoundError: - objstr = ObjectStore(persona.get_identity().uuid) - - if options.list: - for i in args: - try: - for j in objstr.by_file(i): - #print >>sys.stderr, `j._obj` - for k, v in _iterdictlist(j): - print('%s:\t%s' % (k, v)) - except KeyError: - print('ERROR: file not found: %s' % repr(i), file=sys.stderr) - sys.exit(1) - elif options.add: - for i in args: - try: - objs = objstr.by_file(i) - except KeyError: - fobj = objstr - objs = [ persona.by_file(i) ] - - for j in objs: - nobj = j.new_version(*addprops) - objstr.loadobj(nobj) - elif options.delete: - for i in args: - for j in objstr.by_file(i): - obj = j.__to_dict__() - for k in options.delete: - try: - key, v = k.split('=', 1) - obj[key].remove(v) - except ValueError: - del obj[k] - nobj = MDBase.create_obj(obj) - objstr.loadobj(nobj) - else: # pragma: no cover - raise NotImplementedError - - objstr.store(storefname) if __name__ == '__main__': # pragma: no cover main()