#NEWLINE# @ plugins_cmd . command ( 'list' , short_help = 'List all plugins.' ) #NEWLINE# @ click . option ( 'as_json' , '--json' , is_flag = True , help = 'Prints out the data as json.' ) #NEWLINE# @ click . option ( '-v' , '--verbose' , 'verbosity' , count = True , help = 'Increases the verbosity of the output.' ) #NEWLINE# @ pass_context #NEWLINE# def plugins_list_cmd( ctx , as_json , verbosity ) : #NEWLINE# #INDENT# 'This returns a list of all currently actively installed plugins\n    in the project.  By default it only prints out the plugin IDs and\n    version numbers but the entire information can be returned by\n    increasing verbosity with `-v`.  Additionally JSON output can be\n    requested with `--json`.\n    ' #NEWLINE# ctx . load_plugins ( ) #NEWLINE# env = ctx . get_env ( ) #NEWLINE# plugins = sorted ( env . plugins . values ( ) , key = ( lambda x : x . id . lower ( ) ) ) #NEWLINE# if as_json : #NEWLINE# #INDENT# echo_json ( { #NEWLINE# #INDENT# 'plugins' : [ x . to_json ( ) for x in plugins ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( verbosity == 0 ) : #NEWLINE# #INDENT# for plugin in plugins : #NEWLINE# #INDENT# click . echo ( ( '%s (version %s)' % ( plugin . id , plugin . version ) ) ) #NEWLINE# #UNINDENT# return #NEWLINE# #UNINDENT# for ( idx , plugin ) in enumerate ( plugins ) : #NEWLINE# #INDENT# if idx : #NEWLINE# #INDENT# click . echo ( ) #NEWLINE# #UNINDENT# click . echo ( ( '%s (%s)' % ( plugin . name , plugin . id ) ) ) #NEWLINE# for line in plugin . description . splitlines ( ) : #NEWLINE# #INDENT# click . echo ( ( '  %s' % line ) ) #NEWLINE# #UNINDENT# if ( plugin . path is not None ) : #NEWLINE# #INDENT# click . echo ( ( '  path: %s' % plugin . path ) ) #NEWLINE# #UNINDENT# click . echo ( ( '  version: %s' % plugin . version ) ) #NEWLINE# click . echo ( ( '  import-name: %s' % plugin . import_name ) )