|
19 | 19 | from argparse import ArgumentParser
|
20 | 20 | import os
|
21 | 21 | from os.path import dirname, abspath, basename
|
| 22 | +from prettytable import PrettyTable |
22 | 23 | import os.path
|
23 | 24 | import sys
|
24 | 25 | import subprocess
|
@@ -53,7 +54,12 @@ def main():
|
53 | 54 | import_cmd.set_defaults(fn=do_import)
|
54 | 55 | clone_cmd = subparsers.add_parser("clone")
|
55 | 56 | clone_cmd.set_defaults(fn=do_clone)
|
56 |
| - deploy_cmd = subparsers.add_parser("deploy") |
| 57 | + list_cmd = subparsers.add_parser("list", help="list examples in config file in a table") |
| 58 | + list_cmd.set_defaults(fn=do_list) |
| 59 | + symlink_cmd = subparsers.add_parser("symlink", help="create symbolic link to given mbed-os PATH") |
| 60 | + symlink_cmd.add_argument("PATH", help=" path of mbed-os to be symlinked") |
| 61 | + symlink_cmd.set_defaults(fn=do_symlink) |
| 62 | + deploy_cmd = subparsers.add_parser("deploy", help="mbed deploy" ) |
57 | 63 | deploy_cmd.set_defaults(fn=do_deploy)
|
58 | 64 | version_cmd = subparsers.add_parser("tag")
|
59 | 65 | version_cmd.add_argument("tag")
|
@@ -153,6 +159,18 @@ def do_versionning(args, config, examples):
|
153 | 159 | """ Test update the mbed-os to the version specified by the tag """
|
154 | 160 | return lib.update_mbedos_version(config, args.tag, examples)
|
155 | 161 |
|
| 162 | +def do_list(_, config, examples): |
| 163 | + """List the examples in the config file""" |
| 164 | + exp_table = PrettyTable() |
| 165 | + exp_table.hrules = 1 |
| 166 | + exp_table.field_names = ["Name", "Subs", "Feature", "Targets", "Compile", "Test"] |
| 167 | + for example in config["examples"]: |
| 168 | + exp_table.add_row([example['name'], '\n'.join(example['subs']),'\n'.join(example['features']),'\n'.join(example['targets']),example['compile'],example['test']]) |
| 169 | + print(exp_table) |
| 170 | + return 0 |
| 171 | + |
| 172 | +def do_symlink(args, config, examples): |
| 173 | + return lib.symlink_mbedos(config, args.path, examples) |
156 | 174 |
|
157 | 175 | if __name__ == "__main__":
|
158 | 176 | sys.exit(main())
|
0 commit comments