mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 12:09:33 +01:00
format
This commit is contained in:
parent
b643936bdf
commit
71a63b2565
1 changed files with 11 additions and 4 deletions
|
@ -140,7 +140,7 @@ impl ReleaseCommand {
|
||||||
name,
|
name,
|
||||||
} => create_asset(&repo, &api, release, path, name).await?,
|
} => create_asset(&repo, &api, release, path, name).await?,
|
||||||
AssetCommand::Delete { release, asset } => {
|
AssetCommand::Delete { release, asset } => {
|
||||||
delete_asset(&repo, &api, release, asset ).await?
|
delete_asset(&repo, &api, release, asset).await?
|
||||||
}
|
}
|
||||||
AssetCommand::Download {
|
AssetCommand::Download {
|
||||||
release,
|
release,
|
||||||
|
@ -399,15 +399,22 @@ async fn download_asset(
|
||||||
) -> eyre::Result<()> {
|
) -> eyre::Result<()> {
|
||||||
let release = find_release(repo, api, &release).await?;
|
let release = find_release(repo, api, &release).await?;
|
||||||
let file = match &*asset {
|
let file = match &*asset {
|
||||||
"source.zip" => api.download_release_zip(repo.owner(), repo.name(), release.id).await?,
|
"source.zip" => {
|
||||||
"source.tar.gz" => api.download_release_tarball(repo.owner(), repo.name(), release.id).await?,
|
api.download_release_zip(repo.owner(), repo.name(), release.id)
|
||||||
|
.await?
|
||||||
|
}
|
||||||
|
"source.tar.gz" => {
|
||||||
|
api.download_release_tarball(repo.owner(), repo.name(), release.id)
|
||||||
|
.await?
|
||||||
|
}
|
||||||
name => {
|
name => {
|
||||||
let asset = release
|
let asset = release
|
||||||
.assets
|
.assets
|
||||||
.iter()
|
.iter()
|
||||||
.find(|a| a.name == name)
|
.find(|a| a.name == name)
|
||||||
.ok_or_else(|| eyre!("asset not found"))?;
|
.ok_or_else(|| eyre!("asset not found"))?;
|
||||||
api.download_release_attachment(repo.owner(), repo.name(), release.id, asset.id).await?
|
api.download_release_attachment(repo.owner(), repo.name(), release.id, asset.id)
|
||||||
|
.await?
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let file = file.ok_or_else(|| eyre!("asset not found"))?;
|
let file = file.ok_or_else(|| eyre!("asset not found"))?;
|
||||||
|
|
Loading…
Reference in a new issue