def list_packages(self, installed=True, notinstalled=True):
self.profile = Profile()<EOL>installed_packages = []<EOL>notinstalled_packages = []<EOL>for package in self.packages:<EOL><INDENT>data = {<EOL>'<STR_LIT:name>': package,<EOL>'<STR_LIT:version>': None,<EOL>'<STR_LIT:description>': self.packages.get(package).get('<STR_LIT:description>')<EOL>}<EOL>if package in self.profile.packages:<EOL><INDENT>data['<STR_LIT:version>'] = self.profile.get_package_version(<EOL>package, self.get_package_release_name(package))<EOL>installed_packages += [data]<EOL><DEDENT>else:<EOL><INDENT>notinstalled_packages += [data]<EOL><DEDENT><DEDENT>terminal_width, _ = click.get_terminal_size()<EOL>if installed and installed_packages:<EOL><INDENT>click.echo('<STR_LIT>')<EOL>PACKAGELIST_TPL = ('<STR_LIT>')<EOL>click.echo('<STR_LIT:->' * terminal_width)<EOL>click.echo(PACKAGELIST_TPL.format(<EOL>name=click.style('<STR_LIT:Name>', fg='<STR_LIT>'), version='<STR_LIT>',<EOL>description='<STR_LIT>'))<EOL>click.echo('<STR_LIT:->' * terminal_width)<EOL>for package in installed_packages:<EOL><INDENT>click.echo(PACKAGELIST_TPL.format(<EOL>name=click.style(package.get('<STR_LIT:name>'), fg='<STR_LIT>'),<EOL>version=package.get('<STR_LIT:version>'),<EOL>description=package.get('<STR_LIT:description>')))<EOL><DEDENT><DEDENT>if notinstalled and notinstalled_packages:<EOL><INDENT>click.echo('<STR_LIT>')<EOL>PACKAGELIST_TPL = ('<STR_LIT>')<EOL>click.echo('<STR_LIT:->' * terminal_width)<EOL>click.echo(PACKAGELIST_TPL.format(<EOL>name=click.style('<STR_LIT:Name>', fg='<STR_LIT>'),<EOL>description='<STR_LIT>'))<EOL>click.echo('<STR_LIT:->' * terminal_width)<EOL>for package in notinstalled_packages:<EOL><INDENT>click.echo(PACKAGELIST_TPL.format(<EOL>name=click.style(package.get('<STR_LIT:name>'), fg='<STR_LIT>'),<EOL>description=package.get('<STR_LIT:description>')))<EOL><DEDENT><DEDENT>
Return a list with all the installed/notinstalled packages