pull: renamed command from *get* to *pull*
All checks were successful
CI / build (push) Successful in 1m41s

This commit is contained in:
2025-12-01 17:57:57 +01:00
parent 49f0ff004e
commit 4e7f447326
3 changed files with 29 additions and 29 deletions

View File

@@ -1,3 +1,4 @@
pub mod package_info;
pub mod pull;
pub type ProgressCallback<'a> = Option<&'a dyn Fn(&str, &str, usize, usize)>;

View File

@@ -6,8 +6,7 @@ use clap::{Command, arg, command};
extern crate flate2;
mod get;
use get::get;
use pkh::pull::pull;
mod changelog;
use changelog::generate_entry;
@@ -30,8 +29,8 @@ fn main() {
.subcommand_required(true)
.disable_version_flag(true)
.subcommand(
Command::new("get")
.about("Get a source package from the archive or git")
Command::new("pull")
.about("Pull a source package from the archive or git")
.arg(
arg!(-s --series <series> "Target package distribution series").required(false),
)
@@ -53,7 +52,7 @@ fn main() {
.get_matches();
match matches.subcommand() {
Some(("get", sub_matches)) => {
Some(("pull", sub_matches)) => {
let package = sub_matches.get_one::<String>("package").expect("required");
let series = sub_matches.get_one::<String>("series").map(|s| s.as_str());
let dist = sub_matches.get_one::<String>("dist").map(|s| s.as_str());
@@ -66,10 +65,10 @@ fn main() {
.map(|s| s.as_str())
.unwrap_or("");
// Since get is async, we need to block on it
// Since pull is async, we need to block on it
let (pb, progress_callback) = ui::create_progress_bar(&multi);
if let Err(e) = rt.block_on(get(
if let Err(e) = rt.block_on(pull(
package,
version,
series,

View File

@@ -2,8 +2,8 @@ use std::cmp::min;
use std::error::Error;
use std::path::Path;
use pkh::package_info;
use pkh::package_info::PackageInfo;
use crate::package_info;
use crate::package_info::PackageInfo;
use std::process::Command;
@@ -11,7 +11,7 @@ use log::debug;
use regex::Regex;
use pkh::ProgressCallback;
use crate::ProgressCallback;
fn clone_repo(
url: &str,
@@ -300,7 +300,7 @@ async fn fetch_archive_sources(
Ok(())
}
pub async fn get(
pub async fn pull(
package: &str,
_version: &str,
series: Option<&str>,
@@ -421,8 +421,8 @@ pub async fn get(
mod tests {
use super::*;
async fn test_get_package_end_to_end(package: &str, series: Option<&str>, dist: Option<&str>) {
// This test verifies that 'pkh get' clones the repo and fetches the tarball.
async fn test_pull_package_end_to_end(package: &str, series: Option<&str>, dist: Option<&str>) {
// This test verifies that 'pkh pull' clones the repo and fetches the tarball.
// For determinism, we require for tests that either a distro or series is specified,
// as no distribution would mean fallback to system distro
@@ -432,8 +432,8 @@ mod tests {
let temp_dir = tempfile::tempdir().unwrap();
let cwd = temp_dir.path();
// Main 'get' command: the one we want to test
let info = get(package, "", series, "", "", dist, Some(cwd), None)
// Main 'pull' command: the one we want to test
let info = pull(package, "", series, "", "", dist, Some(cwd), None)
.await
.unwrap();
@@ -487,34 +487,34 @@ mod tests {
}
#[tokio::test]
async fn test_get_hello_ubuntu_end_to_end() {
test_get_package_end_to_end("hello", Some("noble"), None).await;
async fn test_pull_hello_ubuntu_end_to_end() {
test_pull_package_end_to_end("hello", Some("noble"), None).await;
}
#[tokio::test]
async fn test_get_hello_debian_end_to_end() {
test_get_package_end_to_end("hello", Some("bookworm"), None).await;
async fn test_pull_hello_debian_end_to_end() {
test_pull_package_end_to_end("hello", Some("bookworm"), None).await;
}
#[tokio::test]
async fn test_get_2048_universe_ubuntu_end_to_end() {
test_get_package_end_to_end("2048", Some("noble"), None).await;
async fn test_pull_2048_universe_ubuntu_end_to_end() {
test_pull_package_end_to_end("2048", Some("noble"), None).await;
}
#[tokio::test]
async fn test_get_1oom_contrib_debian_end_to_end() {
test_get_package_end_to_end("1oom", Some("trixie"), None).await;
async fn test_pull_1oom_contrib_debian_end_to_end() {
test_pull_package_end_to_end("1oom", Some("trixie"), None).await;
}
#[tokio::test]
async fn test_get_agg_svn_fallback_ok() {
test_get_package_end_to_end("agg", Some("trixie"), None).await;
async fn test_pull_agg_svn_fallback_ok() {
test_pull_package_end_to_end("agg", Some("trixie"), None).await;
}
#[tokio::test]
async fn test_get_hello_debian_latest_end_to_end() {
test_get_package_end_to_end("hello", None, Some("debian")).await;
async fn test_pull_hello_debian_latest_end_to_end() {
test_pull_package_end_to_end("hello", None, Some("debian")).await;
}
#[tokio::test]
async fn test_get_hello_ubuntu_latest_end_to_end() {
test_get_package_end_to_end("hello", None, Some("ubuntu")).await;
async fn test_pull_hello_ubuntu_latest_end_to_end() {
test_pull_package_end_to_end("hello", None, Some("ubuntu")).await;
}
}