Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/org> [user/org2] ...`
- Interactive mode's command list, printed on start and by `help`, now shows `backup <user/org> [user/org2] ...` instead of `backup <user/org>`, 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
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/github/backup/BackupCommandLineRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ private void runInteractiveMode() {
System.out.println("=====================================");
System.out.println();
System.out.println("Commands:");
System.out.println(" backup <user/org> - 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/org> [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
Expand Down Expand Up @@ -159,10 +159,10 @@ private void runInteractiveMode() {

case "help":
System.out.println("\nAvailable Commands:");
System.out.println(" backup <user/org> - 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/org> [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;

Expand Down
24 changes: 23 additions & 1 deletion src/test/java/com/github/backup/BackupCommandLineRunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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/org> [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/org> [user/org2] ... - Backup repositories for each user or organization"));
}

@Test
void testRun_InteractiveMode_QuitAlias() throws Exception {
provideInput("quit\n");
Expand Down
Loading