From 8c195fb14d49b40f585b458b3a60671759ba4c67 Mon Sep 17 00:00:00 2001 From: Daniel McCoy Stephenson Date: Wed, 11 Nov 2026 21:02:50 -0700 Subject: [PATCH] List backup with several names in interactive mode's command list Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + .../backup/BackupCommandLineRunner.java | 16 ++++++------- .../backup/BackupCommandLineRunnerTest.java | 24 ++++++++++++++++++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2f9bdb..28e0c2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - The interactive `backup` command now backs up each name it is given, so `backup octocat github` backs up `octocat` and then `github`, as the command line does, instead of looking up the single name `octocat github` on GitHub and failing. A name that fails is reported and the others are still backed up; the command still counts as one backup run for usage reporting, and its usage hint reads `Usage: backup [user/org2] ...` +- Interactive mode's command list, printed on start and by `help`, now shows `backup [user/org2] ...` instead of `backup `, so it no longer suggests that `backup` takes a single name - A scheduled daemon backup no longer stops partway when one user or organization fails with an unchecked exception (such as a `GHException` from github-api while listing repositories): the failure is logged as an error like any other, the remaining users and organizations are still backed up, and the run is still logged and reported as completed. Previously only an `IOException` was handled, so the rest of that run was skipped until the next interval - A backup that reaches the GitHub rate limit no longer looks hung: the GitHub client has always waited silently for the limit to reset, for up to an hour, and now a notice on standard error says so first, with the expected reset time, and suggests `GITHUB_TOKEN` when running anonymously. The waiting itself is unchanged and is documented in `USER_GUIDE.md` and `COMMANDS.md` - `GITHUB_TOKEN` is no longer dropped when the startup check fails for a reason unrelated to the token: only a `401` now prints `Invalid or expired GITHUB_TOKEN` and falls back to anonymous access, while any other failure, such as a network failure, a GitHub error or a `403` from `GET /user`, prints `Could not verify GITHUB_TOKEN` and keeps the token, so a brief outage at startup no longer leaves a daemon limited to 60 requests per hour until it is restarted diff --git a/src/main/java/com/github/backup/BackupCommandLineRunner.java b/src/main/java/com/github/backup/BackupCommandLineRunner.java index 55c9a78..ccd69c3 100644 --- a/src/main/java/com/github/backup/BackupCommandLineRunner.java +++ b/src/main/java/com/github/backup/BackupCommandLineRunner.java @@ -106,10 +106,10 @@ private void runInteractiveMode() { System.out.println("====================================="); System.out.println(); System.out.println("Commands:"); - System.out.println(" backup - Backup repositories for a user or organization"); - System.out.println(" status - View current backup status"); - System.out.println(" help - Show available commands"); - System.out.println(" exit - Exit interactive mode"); + System.out.println(" backup [user/org2] ... - Backup repositories for each user or organization"); + System.out.println(" status - View current backup status"); + System.out.println(" help - Show available commands"); + System.out.println(" exit - Exit interactive mode"); System.out.println(); @SuppressWarnings("resource") // Scanner wraps System.in, which should not be closed @@ -159,10 +159,10 @@ private void runInteractiveMode() { case "help": System.out.println("\nAvailable Commands:"); - System.out.println(" backup - Backup repositories for a user or organization"); - System.out.println(" status - View current backup status"); - System.out.println(" help - Show this help message"); - System.out.println(" exit - Exit interactive mode"); + System.out.println(" backup [user/org2] ... - Backup repositories for each user or organization"); + System.out.println(" status - View current backup status"); + System.out.println(" help - Show this help message"); + System.out.println(" exit - Exit interactive mode"); System.out.println(); break; diff --git a/src/test/java/com/github/backup/BackupCommandLineRunnerTest.java b/src/test/java/com/github/backup/BackupCommandLineRunnerTest.java index 6a43a5d..854c773 100644 --- a/src/test/java/com/github/backup/BackupCommandLineRunnerTest.java +++ b/src/test/java/com/github/backup/BackupCommandLineRunnerTest.java @@ -390,10 +390,32 @@ void testRun_InteractiveMode_HelpCommand() throws Exception { runner.run("-i"); assertTrue(stdout().contains("Available Commands:")); - assertTrue(stdout().contains(" help - Show this help message")); + assertTrue(stdout().contains(" help - Show this help message")); verifyNoInteractions(backupService); } + @Test + void testRun_InteractiveMode_StartBannerListsBackupOfSeveralNames() throws Exception { + provideInput("exit\n"); + + runner.run("-i"); + + assertTrue(stdout().contains( + " backup [user/org2] ... - Backup repositories for each user or organization")); + } + + @Test + void testRun_InteractiveMode_HelpCommandListsBackupOfSeveralNames() throws Exception { + provideInput("help\nexit\n"); + + runner.run("-i"); + + // Only the help output, not the start banner, which lists the same commands + String help = stdout().substring(stdout().indexOf("Available Commands:")); + assertTrue(help.contains( + " backup [user/org2] ... - Backup repositories for each user or organization")); + } + @Test void testRun_InteractiveMode_QuitAlias() throws Exception { provideInput("quit\n");