예제 #1
0
파일: cli.py 프로젝트: jinheking/ephpdoc
  def __init__(self):
    usage = '%prog [ACTION] [options] NAMES...'
    version = _("Ephpdoc, version %s") % ephpdoclib.__version__
    #print version
    optparser = OptionParser(usage=usage, add_help_option=False)
    action_group = OptionGroup(optparser, 'Actions')
    optparser.add_option_group(action_group)
    action_group.add_option("--html",
        action="store", dest="foldername",default="htmldoc",
        help=_("Write HTML output."))
    action_group.add_option("-v","--version",
        action="store_const", dest="action", const="version",
        help=_("Show ephpdoc's version number and exit."))
    
    action_group.add_option("-h", "--help",
        action="store_const", dest="action", const="help",
        help=_("Show this message and exit. "))
    
    output_group = OptionGroup(optparser, 'Output Options')
    optparser.add_option_group(output_group)
    output_group.add_option("--name", "-n",
        dest="prj_name", metavar="NAME",
        help="The documented project's name (for the navigation bar).")
    

    
    optparser.set_defaults(**self.OPTION_DEFAULTS)
    options, names = optparser.parse_args()
    self.opt=options
    if options.action == 'version':
      print version
      sys.exit(0)
    
    if options.action == 'help':
      names = set([n.lower() for n in names])
      optparser.print_help()
      sys.exit(0)

    if options.action == 'html':
      path=os.getcwd()
      path+=os.sep
      path+=options.foldername
      #print options
      ephpdoclib.folder().createHtmlFrameWork(path)
예제 #2
0
# -*- coding: utf-8 -*-
import glob,os,sys
import gettext
import ephpdoclib

'''
 Copyright (C) 2011 Eagle
 Author: Edward Loper <*****@*****.**>
 URL: <http://www.caoqi.com>

 $Id: ephpdoc.py 2011-01-19 17:55 Eagle $
''' 
  #getCurrentPathFilenameList('','')
if '__main__' == __name__:
    try:
        cruentpath = ephpdoclib.folder().getCurrentPath() 
        gettext.install('lang', cruentpath + '\locale', unicode=False)
        gettext.translation('lang', cruentpath + '\language', languages=['zh-CN']).install(True)
        print _('Current Version is') + '0.0.1!'
        print _('Ephpdoc is tool for php that is the function of the PHP inside comments compiled into an HTML document.') 
        
#        fo = ephpdoclib.folder()
#        for item in  fo.dir_list_allfolder(os.getcwd()):
#            print item
        cli = ephpdoclib.cli()
        #print cli.opt.foldername
        ephpdocfile = ephpdoclib.ephpdocfile()
        ephpdocfile.openFile(".\Action\MgModel.class.php", cli.opt.foldername)
        #for item in fo.dir_list_folder(os.getcwd(),r'LC_MESSAGES'):
        #  print item
    except IndexError, Error: