Skip to content

Commit 87ed621

Browse files
committed
✨ Stabilize migrate subcommand
The migrate command has been moved out of experimental and is now a stable CLI subcommand. A deprecation warning is added to the `experimental migrate` alias to inform users to use the new stable `migrate` command, and related module visibility and command dispatch logic are updated accordingly. Mirrors the prior pattern applied to `sort` (f2f15d3) and `delete` (5417b47).
1 parent ec8600d commit 87ed621

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

cli/src/cli.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::{
99
append::AppendCommand, bugreport::BugReportCommand, compat::CompatCommand,
1010
complete::CompleteCommand, concat::ConcatCommand, core::Umask, create::CreateCommand,
1111
delete::DeleteCommand, experimental::ExperimentalCommand, extract::ExtractCommand,
12-
list::ListCommand, sort::SortCommand, split::SplitCommand, strip::StripCommand,
13-
xattr::XattrCommand,
12+
list::ListCommand, migrate::MigrateCommand, sort::SortCommand, split::SplitCommand,
13+
strip::StripCommand, xattr::XattrCommand,
1414
},
1515
utils::{fs::current_umask, process::is_running_as_root},
1616
};
@@ -195,6 +195,8 @@ pub(crate) enum Commands {
195195
Strip(StripCommand),
196196
#[command(about = "Sort entries in archive")]
197197
Sort(SortCommand),
198+
#[command(about = "Upgrade archives created by older PNA versions")]
199+
Migrate(MigrateCommand),
198200
#[command(about = "Manipulate extended attributes")]
199201
Xattr(XattrCommand),
200202
#[command(about = "Generate shell auto complete")]

cli/src/command.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub mod diff;
1515
pub(super) mod experimental;
1616
pub mod extract;
1717
pub mod list;
18-
mod migrate;
18+
pub mod migrate;
1919
pub mod sort;
2020
pub mod split;
2121
pub(crate) mod strip;
@@ -74,6 +74,7 @@ impl Cli {
7474
Commands::Concat(cmd) => cmd.execute(ctx),
7575
Commands::Strip(cmd) => cmd.execute(ctx),
7676
Commands::Sort(cmd) => cmd.execute(ctx),
77+
Commands::Migrate(cmd) => cmd.execute(ctx),
7778
Commands::Xattr(cmd) => cmd.execute(ctx),
7879
Commands::Complete(cmd) => cmd.execute(ctx),
7980
Commands::BugReport(cmd) => cmd.execute(ctx),

cli/src/command/experimental.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@ impl Command for ExperimentalCommand {
3939
ExperimentalCommands::Chown(cmd) => cmd.execute(ctx),
4040
ExperimentalCommands::Chmod(cmd) => cmd.execute(ctx),
4141
ExperimentalCommands::Acl(cmd) => cmd.execute(ctx),
42-
ExperimentalCommands::Migrate(cmd) => cmd.execute(ctx),
42+
ExperimentalCommands::Migrate(cmd) => {
43+
log::warn!(
44+
"`{0} experimental migrate` subcommand was stabilized, use `{0} migrate` instead. this command will be removed in the future.",
45+
std::env::current_exe()
46+
.ok()
47+
.and_then(|it| it.file_name().map(|n| n.to_os_string()))
48+
.unwrap_or_default()
49+
.to_string_lossy()
50+
);
51+
cmd.execute(ctx)
52+
}
4353
ExperimentalCommands::Chunk(cmd) => cmd.execute(ctx),
4454
ExperimentalCommands::Sort(cmd) => {
4555
log::warn!(
@@ -75,7 +85,9 @@ pub(crate) enum ExperimentalCommands {
7585
Chmod(command::chmod::ChmodCommand),
7686
#[command(about = "Manipulate ACLs of entries")]
7787
Acl(command::acl::AclCommand),
78-
#[command(about = "Migrate old format to latest format")]
88+
#[command(
89+
about = "Upgrade archives created by older PNA versions (stabilized, use `pna migrate` command instead. this command will be removed in the future)"
90+
)]
7991
Migrate(command::migrate::MigrateCommand),
8092
#[command(about = "Chunk level operation")]
8193
Chunk(command::chunk::ChunkCommand),

0 commit comments

Comments
 (0)