On 05/03/2016 03:59 PM, Dylan Baker wrote:
This option allows the format of the output string to be modified by
passing a command line argument. This allows for specialized formats to
be printed for other uses than the original usage that print-commands
was designed for.

Can you give an example of what the --format option would look like?

I think the help message below ("Format will be called with the {name} will be replaced with the name of the test, and {command} with the test command") is a bit scrambled.

-Brian




Signed-off-by: Dylan Baker <[email protected]>
---
  framework/programs/print_commands.py | 13 ++++++++++++-
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/framework/programs/print_commands.py 
b/framework/programs/print_commands.py
index 06bd004..c7ccf15 100755
--- a/framework/programs/print_commands.py
+++ b/framework/programs/print_commands.py
@@ -68,6 +68,15 @@ def main(input_):
                          metavar="<regex>",
                          help="Exclude matching tests (can be used more than "
                               "once)")
+    parser.add_argument("--format",
+                        dest="format_string",
+                        default="{name} ::: {command}",
+                        action="store",
+                        help="A python format string to be passed to "
+                             "str.format. Format will be called with the "
+                             "{name} will be replaced with the name of the "
+                             "test, and {command} with the test command. "
+                             "Neither are required.")
      parser.add_argument("testProfile",
                          metavar="<Path to testfile>",
                          help="Path to results folder")
@@ -85,4 +94,6 @@ def main(input_):
      profile_._prepare_test_list()
      for name, test in six.iteritems(profile_.test_list):
          assert isinstance(test, Test)
-        print(name, ':::', get_command(test, piglit_dir))
+        print(args.format_string.format(
+            name=name,
+            command=get_command(test, piglit_dir)))


_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to