Skip to content

Commit

Permalink
feat: list cli output is now sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpavlock committed Oct 2, 2022
1 parent 8a0e650 commit fbb11d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions moe/library/lib_item.py
Expand Up @@ -253,6 +253,10 @@ def __setattr__(self, name, value):
else:
super().__setattr__(name, value)

def __lt__(self, other):
"""Library items implement the `lt` magic method to allow sorting."""
raise NotImplementedError


class PathType(sa.types.TypeDecorator):
"""A custom type for paths for database storage.
Expand Down
2 changes: 1 addition & 1 deletion moe/plugins/list.py
Expand Up @@ -63,7 +63,7 @@ def _parse_args(args: argparse.Namespace):
log.error("No items found to list.")
raise SystemExit(1)

for item in items:
for item in sorted(items):
if args.paths:
print(item.path)
else:
Expand Down

0 comments on commit fbb11d0

Please sign in to comment.