Skip to content

Commit e34b924

Browse files
authored
Added support for show repos command (#196)
1 parent 0f2e8f6 commit e34b924

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

mlc/main.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def process_console_output(res, target, action, run_args):
129129
def build_pre_parser():
130130
pre_parser = argparse.ArgumentParser(add_help=False)
131131
pre_parser.add_argument("action", nargs="?", help="Top-level action (run, build, help, etc.)")
132-
pre_parser.add_argument("target", choices=['run', 'script', 'cache', 'repo'], nargs="?", help="Target (repo, script, cache, ...)")
132+
pre_parser.add_argument("target", choices=['run', 'script', 'cache', 'repo', 'repos'], nargs="?", help="Target (repo, script, cache, ...)")
133133
pre_parser.add_argument("-h", "--help", action="store_true")
134134
return pre_parser
135135

@@ -141,7 +141,7 @@ def build_parser(pre_args):
141141
# General commands
142142
for action in ['run', 'pull', 'test', 'add', 'show', 'list', 'find', 'search', 'rm', 'cp', 'mv', 'help']:
143143
p = subparsers.add_parser(action, add_help=False)
144-
p.add_argument('target', choices=['repo', 'script', 'cache'])
144+
p.add_argument('target', choices=['repo', 'repos', 'script', 'cache'])
145145
p.add_argument('details', nargs='?', help='Details or identifier (optional)')
146146
p.add_argument('extra', nargs=argparse.REMAINDER)
147147

@@ -215,11 +215,11 @@ def main():
215215
216216
Each target has a specific set of actions to tailor automation workflows, as shown below:
217217
218-
| Target | Actions |
219-
|---------|-------------------------------------------------------|
218+
| Target | Actions |
219+
|---------|-----------------------------------------------------------|
220220
| script | run, find/search, rm, mv, cp, add, test, docker-run, show |
221-
| cache | find/search, rm, show |
222-
| repo | pull, search, rm, list, find/search |
221+
| cache | find/search, rm, show |
222+
| repo | pull, search, rm, list, find/search |
223223
224224
Example:
225225
mlc run script detect-os
@@ -286,6 +286,12 @@ def main():
286286
print(help_text)
287287
sys.exit(0)
288288

289+
# show repos alias list repo
290+
if args.command in ("show"):
291+
args.command = "list"
292+
if args.target == "repos":
293+
args.target = "repo"
294+
289295
action = get_action(args.target, default_parent)
290296

291297
if not action or not hasattr(action, args.command):

mlc/repo_action.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ def pull(self, run_args):
447447
def list(self, run_args):
448448
"""
449449
####################################################################################################################
450-
Target: Repo
451-
Action: List
450+
Target: Repo/Repos
451+
Action: List/Show
452452
####################################################################################################################
453453
454454
The `list` action displays all registered MLC repositories along with their aliases and paths.

0 commit comments

Comments
 (0)