def do_get(store, argv): args = docopt(__doc__, argv=argv) entry = args['<entry>'] try: password = store['passwords'][entry] except KeyError: sys.exit('Entry "{}" not found.'.format(entry)) if args['--clipboard']: try: copy(password) except ClipboardError as e: sys.exit(e) else: print(password)
def create_sh_and_check_output(self, name): self.create_sh(name, '/bin/cat >{}/out.txt'.format(self.tmp_dir)) copy('something') with open(os.path.join(self.tmp_dir, 'out.txt'), 'r') as f: eq_(f.read(), 'something')