@@ -546,10 +546,26 @@ def handle_options(
546546 add_help_option = True ,
547547 epilog = 'Use "-- --help" to see `robot` help.' ,
548548)
549+ @click .option (
550+ "--tags / --no-tags" ,
551+ "show_tags" ,
552+ default = False ,
553+ show_default = True ,
554+ help = "Show the tags that are present." ,
555+ )
549556@add_options (* ROBOT_OPTIONS )
557+ @click .option (
558+ "--full-paths / --no-full-paths" ,
559+ "full_paths" ,
560+ default = False ,
561+ show_default = True ,
562+ help = "Show full paths instead of releative." ,
563+ )
550564@pass_application
551565def all (
552566 app : Application ,
567+ full_paths : bool ,
568+ show_tags : bool ,
553569 by_longname : Tuple [str , ...],
554570 exclude_by_longname : Tuple [str , ...],
555571 robot_options_and_args : Tuple [str , ...],
@@ -578,25 +594,27 @@ def all(
578594 def print (item : TestItem , indent : int = 0 ) -> Iterable [str ]:
579595 type = click .style (
580596 item .type .capitalize () if item .type == "suite" else tests_or_tasks .capitalize (),
581- fg = "green " ,
597+ fg = "blue " ,
582598 )
583599
584600 if item .type == "test" :
585- yield f" { type } : { item .longname } { os .linesep } "
601+ yield " "
602+ yield type
603+ yield click .style (f": { item .longname } " , bold = True )
604+ yield click .style (
605+ f" ({ item .source if full_paths else item .rel_source } "
606+ f":{ item .range .start .line + 1 if item .range is not None else 1 } ){ os .linesep } "
607+ )
608+ if show_tags and item .tags :
609+ yield click .style (" Tags:" , bold = True , fg = "green" )
610+ yield f" { ', ' . join (normalize (str (tag ), ignore = '_' ) for tag in sorted (item .tags ))} { os .linesep } "
586611 else :
587- yield f"{ type } : { item .longname } { os .linesep } "
588-
612+ yield type
613+ yield f": { item .longname } "
614+ yield click .style (f" ({ item .source if full_paths else item .rel_source } ){ os .linesep } " )
589615 for child in item .children or []:
590616 yield from print (child , indent + 2 )
591617
592- # type = click.style(
593- # item.type.capitalize() if item.type == "suite" else tests_or_tasks.capitalize(), fg="green"
594- # )
595- # yield (f"{' ' * indent}{type}: {item.name}{os.linesep}")
596- # if item.children:
597- # for child in item.children:
598- # yield from print(child, indent + 2)
599-
600618 if indent == 0 :
601619 yield os .linesep
602620 yield f"Summary:{ os .linesep } "
@@ -654,24 +672,27 @@ def tests(
654672 ```
655673 """
656674
657- _suite , collector , diagnostics = handle_options (app , by_longname , exclude_by_longname , robot_options_and_args )
675+ suite , collector , diagnostics = handle_options (app , by_longname , exclude_by_longname , robot_options_and_args )
658676
659677 if collector .all .children :
660678 if app .config .output_format is None or app .config .output_format == OutputFormat .TEXT :
661679
680+ tests_or_tasks = "Task" if suite .rpa else "Test"
681+
662682 def print (items : List [TestItem ]) -> Iterable [str ]:
663683 for item in items :
664- yield click .style (
665- f"{ item .longname } " ,
666- bold = True ,
667- fg = "green" if show_tags else None ,
684+ type = click .style (
685+ item .type .capitalize () if item .type == "suite" else tests_or_tasks .capitalize (),
686+ fg = "blue" ,
668687 )
688+ yield type
689+ yield click .style (f": { item .longname } " , bold = True )
669690 yield click .style (
670691 f" ({ item .source if full_paths else item .rel_source } "
671692 f":{ item .range .start .line + 1 if item .range is not None else 1 } ){ os .linesep } "
672693 )
673694 if show_tags and item .tags :
674- yield click .style (" Tags:" , bold = True )
695+ yield click .style (" Tags:" , bold = True , fg = "green" )
675696 yield f" { ', ' . join (normalize (str (tag ), ignore = '_' ) for tag in sorted (item .tags ))} { os .linesep } "
676697
677698 if collector .tests :
@@ -687,9 +708,17 @@ def print(items: List[TestItem]) -> Iterable[str]:
687708 epilog = 'Use "-- --help" to see `robot` help.' ,
688709)
689710@add_options (* ROBOT_OPTIONS )
711+ @click .option (
712+ "--full-paths / --no-full-paths" ,
713+ "full_paths" ,
714+ default = False ,
715+ show_default = True ,
716+ help = "Show full paths instead of releative." ,
717+ )
690718@pass_application
691719def suites (
692720 app : Application ,
721+ full_paths : bool ,
693722 by_longname : Tuple [str , ...],
694723 exclude_by_longname : Tuple [str , ...],
695724 robot_options_and_args : Tuple [str , ...],
@@ -716,7 +745,12 @@ def suites(
716745
717746 def print (items : List [TestItem ]) -> Iterable [str ]:
718747 for item in items :
719- yield f"{ item .longname } { os .linesep } "
748+ # yield f"{item.longname}{os.linesep}"
749+ yield click .style (
750+ f"{ item .longname } " ,
751+ bold = True ,
752+ )
753+ yield click .style (f" ({ item .source if full_paths else item .rel_source } ){ os .linesep } " )
720754
721755 if collector .suites :
722756 app .echo_via_pager (print (collector .suites ))
0 commit comments