Skip to content

Add --path flag to /show list command for filtering running shows #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/us/mcparks/showscript/Shows.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,30 @@ public void stopShow(CommandSender sender, @Argument(value = "showName", suggest

@CommandMethod("show list")
@CommandPermission("castmember")
public void listShows(CommandSender sender) {
public void listShows(CommandSender sender,
@Flag(value="path", suggestions = "showDirectoryNames") String path) {
List<ShowScheduler> shows = main.getActiveShows();
sender.sendMessage(ChatColor.AQUA + "" + shows.size() + ChatColor.GREEN + " shows: ");
for (ShowScheduler show : shows) {
List<ShowScheduler> filteredShows = shows;

// Filter by path if provided
if (path != null) {
filteredShows = shows.stream()
.filter(show -> show.getName().startsWith(path))
.collect(Collectors.toList());
}

// Build message with filter info if applicable
StringBuilder message = new StringBuilder(ChatColor.AQUA)
.append(filteredShows.size())
.append(ChatColor.GREEN)
.append(" shows")
.append(path != null ? " (filtered by path: " + path + ")" : "")
.append(": ");

sender.sendMessage(message.toString());

// Display shows
for (ShowScheduler show : filteredShows) {
sender.sendMessage(ChatColor.AQUA + show.getName() + ChatColor.GRAY + " - " + ChatColor.GREEN + "Syntax Version: " + show.getSyntaxVersion());
}
}
Expand Down