parameters: (url, order)
docstring: Display all of the url matching routes for the project.
  
      Borrowed from Flask-Script, converted to use Click.
docstring_summary: Display all of the url matching routes for the project.
docstring_tokens: Display all of the url matching routes for the project .
function: def urls(url, order):
      """Display all of the url matching routes for the project.
  
      Borrowed from Flask-Script, converted to use Click.
      """
      rows = []
      column_headers = ('Rule', 'Endpoint', 'Arguments')
  
      if url:
          try:
              rule, arguments = (
                  current_app.url_map.bind('localhost')
                  .match(url, return_rule=True))
              rows.append((rule.rule, rule.endpoint, arguments))
              column_length = 3
          except (NotFound, MethodNotAllowed) as e:
              rows.append(('<{}>'.format(e), None, None))
              column_length = 1
      else:
          rules = sorted(
              current_app.url_map.iter_rules(),
              key=lambda rule: getattr(rule, order))
          for rule in rules:
              rows.append((rule.rule, rule.endpoint, None))
          column_length = 2
  
      str_template = ''
      table_width = 0
  
      if column_length >= 1:
          max_rule_length = max(len(r[0]) for r in rows)
          max_rule_length = max_rule_length if max_rule_length > 4 else 4
          str_template += '{:' + str(max_rule_length) + '}'
          table_width += max_rule_length
  
      if column_length >= 2:
          max_endpoint_length = max(len(str(r[1])) for r in rows)
          # max_endpoint_length = max(rows, key=len)
          max_endpoint_length = (
              max_endpoint_length if max_endpoint_length > 8 else 8)
          str_template += '  {:' + str(max_endpoint_length) + '}'
          table_width += 2 + max_endpoint_length
  
      if column_length >= 3:
          max_arguments_length = max(len(str(r[2])) for r in rows)
          max_arguments_length = (
              max_arguments_length if max_arguments_length > 9 else 9)
          str_template += '  {:' + str(max_arguments_length) + '}'
          table_width += 2 + max_arguments_length
  
      click.echo(str_template.format(*column_headers[:column_length]))
      click.echo('-' * table_width)
  
      for row in rows:
          click.echo(str_template.format(*row[:column_length]))
function_tokens: def urls ( url , order ) : rows = [ ] column_headers = ( 'Rule' , 'Endpoint' , 'Arguments' ) if url : try : rule , arguments = ( current_app . url_map . bind ( 'localhost' ) . match ( url , return_rule = True ) ) rows . append ( ( rule . rule , rule . endpoint , arguments ) ) column_length = 3 except ( NotFound , MethodNotAllowed ) as e : rows . append ( ( '<{}>' . format ( e ) , None , None ) ) column_length = 1 else : rules = sorted ( current_app . url_map . iter_rules ( ) , key = lambda rule : getattr ( rule , order ) ) for rule in rules : rows . append ( ( rule . rule , rule . endpoint , None ) ) column_length = 2 str_template = '' table_width = 0 if column_length >= 1 : max_rule_length = max ( len ( r [ 0 ] ) for r in rows ) max_rule_length = max_rule_length if max_rule_length > 4 else 4 str_template += '{:' + str ( max_rule_length ) + '}' table_width += max_rule_length if column_length >= 2 : max_endpoint_length = max ( len ( str ( r [ 1 ] ) ) for r in rows ) # max_endpoint_length = max(rows, key=len) max_endpoint_length = ( max_endpoint_length if max_endpoint_length > 8 else 8 ) str_template += '  {:' + str ( max_endpoint_length ) + '}' table_width += 2 + max_endpoint_length if column_length >= 3 : max_arguments_length = max ( len ( str ( r [ 2 ] ) ) for r in rows ) max_arguments_length = ( max_arguments_length if max_arguments_length > 9 else 9 ) str_template += '  {:' + str ( max_arguments_length ) + '}' table_width += 2 + max_arguments_length click . echo ( str_template . format ( * column_headers [ : column_length ] ) ) click . echo ( '-' * table_width ) for row in rows : click . echo ( str_template . format ( * row [ : column_length ] ) )