Update the remote convention in leo.toml

This commit is contained in:
raychu86 2020-08-28 20:15:08 -07:00
parent b0dcca1345
commit f5aba15d35
2 changed files with 12 additions and 5 deletions

View File

@ -107,8 +107,8 @@ impl CLI for PublishCommand {
zip_file.write(&path)?;
let form_data = Form::new()
.text("name", package_name)
.text("remote", package_remote)
.text("name", package_name.clone())
.text("remote", format!("{}/{}", package_remote.author, package_name))
.text("version", package_version)
.file("file", zip_file.get_file_path(&path))?;

View File

@ -26,13 +26,18 @@ use std::{
pub const MANIFEST_FILE_NAME: &str = "Leo.toml";
#[derive(Clone, Deserialize)]
pub struct Remote {
pub author: String,
}
#[derive(Deserialize)]
pub struct Package {
pub name: String,
pub version: String,
pub description: Option<String>,
pub license: Option<String>,
pub remote: Option<String>,
pub remote: Option<Remote>,
}
#[derive(Deserialize)]
@ -77,7 +82,7 @@ impl Manifest {
self.package.license.clone()
}
pub fn get_package_remote(&self) -> Option<String> {
pub fn get_package_remote(&self) -> Option<Remote> {
self.package.remote.clone()
}
@ -98,8 +103,10 @@ impl Manifest {
name = "{name}"
version = "0.1.0"
description = "The {name} package"
remote = "[AUTHOR]/{name}"
license = "MIT"
[remote]
author = "[AUTHOR]"
"#,
name = self.package.name
)