Skip to content

Commit 6c73f65

Browse files
committed
scripts: sort boards alphabetically
Sort the output alphabetically when executing 'west boards'. Doing so makes it simpler to locate boards while scrolling through the list of all accessible boards. This method is compatible with the '-n' argument too, which also will result in a filtered and sorted list. Signed-off-by: Joakim Bech <joakim.bech@gmail.com>
1 parent 76e1fc7 commit 6c73f65

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/west_commands/boards.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def do_run(self, args, _):
9292
args.board_roots += module_settings['board_root']
9393
args.soc_roots += module_settings['soc_root']
9494

95-
for board in list_boards.find_boards(args):
95+
for board in sorted(list_boards.find_boards(args),
96+
key=lambda b: b.name):
9697
if name_re is not None and not name_re.search(board.name):
9798
continue
9899

@@ -106,7 +107,8 @@ def do_run(self, args, _):
106107
revisions=revisions_list,
107108
dir=board.dir, hwm=board.hwm, qualifiers=''))
108109

109-
for board in list_boards.find_v2_boards(args).values():
110+
for board in sorted(list_boards.find_v2_boards(args).values(),
111+
key=lambda b: b.name):
110112
if name_re is not None and not name_re.search(board.name):
111113
continue
112114

0 commit comments

Comments
 (0)