示例#1
0
  version      = "\
             linkencoder -     By Leonardo Oliveira\n\
             Language    -     Python\n\
             Version     -     2.3\n\
"

  help_string  = "\
Parser para realizar um encode em todos os links localizados\n\
dentro de tags href\n\
-h, -help                 \tmostra esse menu de ajuda\n\
-version                  \tmostra a versao da aplicacao\n\
-v, -generate-verbose     \tdebug do que esta sendo feito\n\
-no-output                \tnao salva o arquivo de saida, mas coloca seu conteudo no clipboard\n\
"

  if parameters.param_exists (argv, 'generate-verbose') or parameters.param_exists (argv, 'v'):
      verbose = True
  if parameters.param_exists (argv, 'h') or parameters.param_exists (argv, 'help'):
      stdout.write (help_string+"\n")
      exit ()
  if parameters.param_exists (argv, 'version'):
      stdout.write (version+"\n")
      exit ()
  if parameters.param_exists (argv, 'no-output'):
      change_clipboard = True
  elif parameters.param_exists (argv, 'output'):
      argv_values = parameters.explode (argv)
      outputpath = argv_values['parameter'][0]

  argv_values = parameters.explode (argv)
  for i in range (0, len (argv_values['parameter'])):
示例#2
0
import term
import parameters

terminal = term.Color()

def showHelp():
    helpMesage = "\
    -tag           \t\t    tag a ser buscada\n\
    -pattern       \t\t    string que define a posicao de insercao [a cada ocorrencia]\n\
    -p             \t\t    parametro a se adicionado\n\
    -f             \t\t    file absolute path\n\
                 "
    print helpMesage


if parameters.param_exists (argv, 'tag', 0) == 0 or parameters.param_exists (argv, 'pattern', 0) == 0 or parameters.param_exists (argv, 'p', 0) == 0 or parameters.param_exists (argv, 'f', 0) == 0:
    showHelp()
    exit()

itagtosearch = 1
iparametertoadd = 2
icharpattern = 3
istartfileinput = 4

tagtosearch = ''
stringpattern = ''
parametertoadd = ''
inputfile = ''
args = parameters.explode (argv, 1, ('tag', 'pattern', 'p', 'f'))

tagtosearch = args['tag']
示例#3
0
        -dir           \t directory abspath\n\
        -maxdepth      \t max recursion level\n\
        -execute       \t excute command\n\
        -h, -help      \t show this menu\n\
                  "
    print (helpmessage)

if len (sys.argv) > 1:
    args = explode (sys.argv, 1, ('dir', 'maxdepth'))
    types = args['parameter']
    commands = args['command']

    source = "."
    maxdepth = 5
    count = False

    if param_exists (sys.argv, 'help') or param_exists(sys.argv, 'h'):
       showHelp()
       sys.exit ()
    if param_exists (sys.argv, 'dir'):
        source = args['dir']
    if param_exists (sys.argv, 'maxdepth'):
        maxdepth = args['maxdepth']
    if param_exists (sys.argv, 'count'):
        count = True

    query = []
    query = getByType (types, source, True, int (maxdepth))
    for i in query: print i
    if count: print ('Total: '+str(len (query)))