Compare commits

..

2 Commits

Author SHA1 Message Date
641163a495 Implement dry-run mode.
Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
2024-05-02 13:17:02 +02:00
75c663eb1e Update help information.
Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
2024-05-02 13:12:34 +02:00
2 changed files with 20 additions and 11 deletions

View File

@ -21,19 +21,22 @@ is especially helpful if the last update broke your system for some reason.
.SH "OPTIONS"
.TP
\fB\-i\fR
Interactively select the transactions to undo (default behavior)
Enter interactive mode to select package operations to undo (default behavior)
.TP
\fB\-r\fR
Non-interactively undo transactions
Non-interactively undo entire transactions
.TP
\fB\-t\fR <\fInum\fR>
Select number of transactions to include (default: 1)
Specify the number of transactions to include (default: 1)
.TP
\fB\-d\fR
Dry run, i.e. don't actually do anything
.TP
\fB\-h\fR
Show help information
Show this help information
.TP
\fB\-v\fR
Show program version
Print program version
.SH "AUTHOR"
Written by Nicolás A. Ortega Froysa.

View File

@ -47,9 +47,9 @@ USAGE:
$PROG_NAME -v
OPTIONS:
-i Enter interactive mode to select packages to downgrade [default behavior]
-r Automatically downgrade all packages from last upgrade
-t <num> Specify the number of transactions to include for undoing selection [default 1]
-i Enter interactive mode to select package operations to undo (default behavior)
-r Non-interactively undo entire transactions
-t <num> Specify the number of transactions to include (default: 1)
-d Dry run, i.e. don't actually do anything
-h Show this help information
-v Print program version\n");
@ -239,6 +239,12 @@ foreach my $tx (@undo_txs) {
}
}
if ($dry_run) {
print("$pkgmgr->{remove} $remove_pkgs\n") if ($remove_pkgs ne '');
print("$pkgmgr->{install_remote} $remote_install_pkgs\n") if ($remote_install_pkgs ne '');
print("$pkgmgr->{install_local} $local_install_pkgs\n") if ($local_install_pkgs ne '');
} else {
system("$pkgmgr->{remove} $remove_pkgs") if ($remove_pkgs ne '');
system("$pkgmgr->{install_remote} $remote_install_pkgs") if ($remote_install_pkgs ne '');
system("$pkgmgr->{install_local} $local_install_pkgs") if ($local_install_pkgs ne '');
}