def user(self, name=None, clean=False, remote=None, password=None): if clean: localdb = LocalDB(self._client_cache.localdb) localdb.init(clean=True) self._user_io.out.success("Deleted user data") return self._manager.user(remote, name, password)
def user(self, *parameters): """ shows or change the current user """ parser = argparse.ArgumentParser(description=self.user.__doc__, prog="conan user") parser.add_argument( "name", nargs='?', default=None, help='Username you want to use. ' 'If no name is provided it will show the current user.') parser.add_argument( "-p", "--password", help='User password. Use double quotes ' 'if password with spacing, and escape quotes if existing') parser.add_argument("--remote", "-r", help='look for in the remote storage') parser.add_argument('-c', '--clean', default=False, action='store_true', help='Remove user and tokens for all remotes') args = parser.parse_args(*parameters) # To enable -h if args.clean: localdb = LocalDB(self._conan_paths.localdb) localdb.init(clean=True) self._user_io.out.success("Deleted user data") return self._manager.user(args.remote, args.name, args.password)
def localdb_test(self): tmp_dir = temp_folder() db_file = os.path.join(tmp_dir, "dbfile") localdb = LocalDB(db_file) # Test write and read login localdb.init() login, token = localdb.get_login() self.assertIsNone(login) self.assertIsNone(token) localdb.set_login(("pepe", "token")) login, token = localdb.get_login() self.assertEquals("pepe", login) self.assertEquals("token", token) self.assertEquals("pepe", localdb.get_username())
def localdb_test(self): tmp_dir = temp_folder() db_file = os.path.join(tmp_dir, "dbfile") localdb = LocalDB(db_file) # Test write and read login localdb.init() user, token = localdb.get_login("myurl1") self.assertIsNone(user) self.assertIsNone(token) localdb.set_login(("pepe", "token"), "myurl1") user, token = localdb.get_login("myurl1") self.assertEquals("pepe", user) self.assertEquals("token", token) self.assertEquals("pepe", localdb.get_username("myurl1"))
def user(self, *parameters): """ shows or change the current user """ parser = argparse.ArgumentParser(description=self.user.__doc__, prog="conan user") parser.add_argument("name", nargs='?', default=None, help='Username you want to use. ' 'If no name is provided it will show the current user.') parser.add_argument("-p", "--password", help='User password. Use double quotes ' 'if password with spacing, and escape quotes if existing') parser.add_argument("--remote", "-r", help='look for in the remote storage') parser.add_argument('-c', '--clean', default=False, action='store_true', help='Remove user and tokens for all remotes') args = parser.parse_args(*parameters) # To enable -h if args.clean: localdb = LocalDB(self._conan_paths.localdb) localdb.init(clean=True) self._user_io.out.success("Deleted user data") return self._manager.user(args.remote, args.name, args.password)
def users_clean(localdb_file): localdb = LocalDB(localdb_file) localdb.init(clean=True)
def users_clean(client_cache): localdb = LocalDB(client_cache.localdb) localdb.init(clean=True)