<s> import os <EOL> from django . conf import settings <EOL> from django . core . management . base import BaseCommand <EOL> from optparse import make_option <EOL> from nodeconductor . core . docs import ApiDocs <EOL> class Command ( BaseCommand ) : <EOL> help = "<STR_LIT>" <EOL> args = "<STR_LIT>" <EOL> option_list = BaseCommand . option_list + ( <EOL> make_option ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store>' , dest = '<STR_LIT:path>' , <EOL> default = '<STR_LIT>' , help = '<STR_LIT>' ) , <EOL> ) <EOL> def handle ( self , * args , ** options ) : <EOL> path = options . get ( '<STR_LIT:path>' ) <EOL> path = path if path . startswith ( '<STR_LIT:/>' ) else os . path . join ( settings . BASE_DIR , path ) <EOL> if not os . path . isdir ( path ) : <EOL> os . makedirs ( path ) <EOL> else : <EOL> for f in os . listdir ( path ) : <EOL> if f . endswith ( "<STR_LIT>" ) : <EOL> os . remove ( os . path . join ( path , f ) ) <EOL> self . stdout . write ( self . style . MIGRATE_HEADING ( '<STR_LIT>' ) ) <EOL> docs = ApiDocs ( apps = args ) <EOL> self . stdout . write ( self . style . MIGRATE_HEADING ( '<STR_LIT>' ) ) <EOL> docs . generate ( path ) </s>
