Skip to content

Commit

Permalink
Support '--order=maintainer'
Browse files Browse the repository at this point in the history
  • Loading branch information
raimon49 committed Apr 8, 2023
1 parent 275d500 commit 0e47fb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions piplicenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,8 @@ def get_sortby(args: CustomNamespace) -> str:
return "Name"
elif args.order == OrderArg.AUTHOR and args.with_authors:
return "Author"
elif args.order == OrderArg.MAINTAINER and args.with_maintainers:
return "Maintainer"
elif args.order == OrderArg.URL and args.with_urls:
return "URL"

Expand Down Expand Up @@ -744,6 +746,7 @@ class OrderArg(NoValueEnum):
LICENSE = L = auto()
NAME = N = auto()
AUTHOR = A = auto()
MAINTAINER = M = auto()
URL = U = auto()


Expand Down
7 changes: 7 additions & 0 deletions test_piplicenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,13 @@ def test_order_author(self) -> None:
sortby = get_sortby(args)
self.assertEqual("Author", sortby)

def test_order_maintainer(self) -> None:
order_maintainer_args = ["--order=maintainer", "--with-maintainers"]
args = self.parser.parse_args(order_maintainer_args)

sortby = get_sortby(args)
self.assertEqual("Maintainer", sortby)

def test_order_url(self) -> None:
order_url_args = ["--order=url", "--with-urls"]
args = self.parser.parse_args(order_url_args)
Expand Down

0 comments on commit 0e47fb9

Please sign in to comment.