AuthorObjOrString -> AuthorVariant

This commit is contained in:
SkyfallWasTaken 2024-07-30 09:15:55 +01:00
parent f79cdc95b8
commit 2181a82cb8
2 changed files with 4 additions and 4 deletions

View file

@ -4,7 +4,7 @@ use camino::Utf8PathBuf;
use color_eyre::eyre::eyre; use color_eyre::eyre::eyre;
use color_eyre::Result; use color_eyre::Result;
use dialoguer::{theme::ColorfulTheme, Confirm, Input}; use dialoguer::{theme::ColorfulTheme, Confirm, Input};
use dinopkg_package_json::{AuthorObjOrString, PackageJson}; use dinopkg_package_json::{AuthorVariant, PackageJson};
use gix_config::File as GitConfigFile; use gix_config::File as GitConfigFile;
use maplit::hashmap; use maplit::hashmap;
use owo_colors::OwoColorize; use owo_colors::OwoColorize;
@ -100,7 +100,7 @@ pub async fn init() -> Result<()> {
let package_json = PackageJson { let package_json = PackageJson {
name: package_name, name: package_name,
version, version,
author: Some(AuthorObjOrString::String(author)), author: Some(AuthorVariant::String(author)),
repository: Some(git_repository), repository: Some(git_repository),
license: Some(license), license: Some(license),
description: Some(description), description: Some(description),

View file

@ -13,7 +13,7 @@ mod util;
pub struct PackageJson { pub struct PackageJson {
pub name: String, pub name: String,
pub version: String, pub version: String,
pub author: Option<AuthorObjOrString>, pub author: Option<AuthorVariant>,
#[serde(default = "default_as_false")] #[serde(default = "default_as_false")]
#[serde(skip_serializing_if = "is_false")] #[serde(skip_serializing_if = "is_false")]
pub private: bool, pub private: bool,
@ -30,7 +30,7 @@ pub struct PackageJson {
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
#[serde(untagged)] #[serde(untagged)]
pub enum AuthorObjOrString { pub enum AuthorVariant {
Author { name: String, url: Option<String> }, Author { name: String, url: Option<String> },
String(String), String(String),
} }