<s> import logging <EOL> import os <EOL> import sys <EOL> import click <EOL> cmd_folder = os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , <EOL> '<STR_LIT>' ) ) <EOL> class CLI ( click . MultiCommand ) : <EOL> def list_commands ( self , ctx ) : <EOL> """<STR_LIT>""" <EOL> commands = [ ] <EOL> for filename in os . listdir ( cmd_folder ) : <EOL> if filename . endswith ( '<STR_LIT>' ) and filename . startswith ( '<STR_LIT>' ) : <EOL> commands . append ( filename [ <NUM_LIT:4> : - <NUM_LIT:3> ] ) <EOL> commands . sort ( ) <EOL> return commands <EOL> def get_command ( self , ctx , name ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> if sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:2> : <EOL> name = name . encode ( '<STR_LIT:ascii>' , '<STR_LIT:replace>' ) <EOL> mod = __import__ ( '<STR_LIT>' + name , <EOL> None , None , [ '<STR_LIT>' ] ) <EOL> except ImportError as e : <EOL> logging . error ( '<STR_LIT>' . format ( name , e ) ) <EOL> exit ( <NUM_LIT:1> ) <EOL> return mod . cli <EOL> @ click . command ( cls = CLI ) <EOL> def cli ( ) : <EOL> """<STR_LIT>""" <EOL> pass </s>
