Skip to content

Commit

Permalink
Merge pull request #152 from tanyyyming/add-musician-to-band-enhancement
Browse files Browse the repository at this point in the history
Add musician to band enhancement
  • Loading branch information
wanghejin authored Nov 3, 2023
2 parents 9243ed6 + 5a5c313 commit b8a61a3
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,12 @@ public AddMusicianToBandCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
AddMusicianToBandCommand.MESSAGE_USAGE));
}
try {
Index bandIndex = ParserUtil.parseIndex(argMultimap.getValue(PREFIX_BINDEX).get());
List<Index> musicianIndices = new ArrayList<>();
for (String indexString : argMultimap.getAllValues(PREFIX_MINDEX)) {
musicianIndices.add(ParserUtil.parseIndex(indexString));
}
return new AddMusicianToBandCommand(bandIndex, musicianIndices);
} catch (ParseException pe) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddMusicianToBandCommand.MESSAGE_USAGE), pe);
Index bandIndex = ParserUtil.parseIndex(argMultimap.getValue(PREFIX_BINDEX).get());
List<Index> musicianIndices = new ArrayList<>();
for (String indexString : argMultimap.getAllValues(PREFIX_MINDEX)) {
musicianIndices.add(ParserUtil.parseIndex(indexString));
}
return new AddMusicianToBandCommand(bandIndex, musicianIndices);
}

/**
Expand Down

0 comments on commit b8a61a3

Please sign in to comment.