Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

take name of transferred package as a command line argument

author
Giacomo Cavalieri
committer
Louis Pilfold
date (Sep 18, 2025, 4:27 PM +0100) commit 173000fd parent 207231f5 change-id tyoxkztn
+13 -13
+7 -5
compiler-cli/src/lib.rs
··· 456 456 457 457 #[derive(Subcommand, Debug)] 458 458 enum Owner { 459 - /// Transfers ownership of this package to a new Hex user 459 + /// Transfers ownership of the given package to a new Hex user 460 460 /// 461 461 /// This command uses this environment variable: 462 462 /// ··· 464 464 /// 465 465 #[command(verbatim_doc_comment)] 466 466 Transfer { 467 + package: String, 468 + 467 469 /// The username or email of the new owner 468 470 #[arg(long = "to")] 469 471 username_or_email: String, ··· 675 677 hex::revert(&paths, package, version) 676 678 } 677 679 678 - Command::Hex(Hex::Owner(Owner::Transfer { username_or_email })) => { 679 - let paths = find_project_paths()?; 680 - owner::transfer(&paths, username_or_email) 681 - } 680 + Command::Hex(Hex::Owner(Owner::Transfer { 681 + package, 682 + username_or_email, 683 + })) => owner::transfer(package, username_or_email), 682 684 683 685 Command::Add { packages, dev } => { 684 686 let paths = find_project_paths()?;
+4 -6
compiler-cli/src/owner.rs
··· 1 1 use crate::{cli, http::HttpClient}; 2 - use gleam_core::{Result, hex, paths::ProjectPaths}; 2 + use gleam_core::{Result, hex}; 3 3 use std::time::Instant; 4 4 5 - pub fn transfer(paths: &ProjectPaths, new_owner_username_or_email: String) -> Result<()> { 6 - let config = crate::config::root_config(paths)?; 5 + pub fn transfer(package: String, new_owner_username_or_email: String) -> Result<()> { 7 6 let should_transfer_ownership = cli::confirm(&format!( 8 7 "Transferring ownership of this package will remove all current owners 9 8 and make {new_owner_username_or_email} its new owner. 10 - Do you wish to transfer ownership of `{}` to {new_owner_username_or_email}?", 11 - config.name 9 + Do you wish to transfer ownership of `{package}` to {new_owner_username_or_email}?", 12 10 ))?; 13 11 14 12 if !should_transfer_ownership { ··· 25 23 cli::print_transferring_ownership(); 26 24 runtime.block_on(hex::transfer_owner( 27 25 &api_key, 28 - &config.name, 26 + package, 29 27 new_owner_username_or_email, 30 28 &hex_config, 31 29 &HttpClient::new(),
+2 -2
compiler-core/src/hex.rs
··· 46 46 47 47 pub async fn transfer_owner<Http: HttpClient>( 48 48 api_key: &str, 49 - package_name: &str, 49 + package_name: String, 50 50 new_owner_username_or_email: String, 51 51 config: &hexpm::Config, 52 52 http: &Http, ··· 57 57 new_owner_username_or_email 58 58 ); 59 59 let request = 60 - hexpm::transfer_owner_request(package_name, &new_owner_username_or_email, api_key, config); 60 + hexpm::transfer_owner_request(&package_name, &new_owner_username_or_email, api_key, config); 61 61 let response = http.send(request).await?; 62 62 hexpm::transfer_owner_response(response).map_err(Error::hex) 63 63 }