@@ -58,6 +58,7 @@ pub enum Template {
5858 Preact ,
5959 PreactTs ,
6060 Blazor ,
61+ Dioxus ,
6162}
6263
6364impl Display for Template {
@@ -80,6 +81,7 @@ impl Display for Template {
8081 Template :: Preact => write ! ( f, "preact" ) ,
8182 Template :: PreactTs => write ! ( f, "preact-ts" ) ,
8283 Template :: Blazor => write ! ( f, "blazor" ) ,
84+ Template :: Dioxus => write ! ( f, "dioxus" ) ,
8385 }
8486 }
8587}
@@ -105,6 +107,7 @@ impl FromStr for Template {
105107 "preact" => Ok ( Template :: Preact ) ,
106108 "preact-ts" => Ok ( Template :: PreactTs ) ,
107109 "blazor" => Ok ( Template :: Blazor ) ,
110+ "dioxus" => Ok ( Template :: Dioxus ) ,
108111 _ => Err ( format ! (
109112 "{YELLOW}{s}{RESET} is not a valid template. Valid templates are [{}]" ,
110113 Template :: ALL
@@ -133,6 +136,7 @@ impl Template {
133136 Template :: Blazor => {
134137 "Blazor - (https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor/)"
135138 }
139+ Template :: Dioxus => "Dioxus - (https://dioxuslabs.com/)" ,
136140 _ => unreachable ! ( ) ,
137141 }
138142 }
@@ -157,6 +161,7 @@ impl<'a> Template {
157161 Template :: Preact ,
158162 Template :: PreactTs ,
159163 Template :: Blazor ,
164+ Template :: Dioxus ,
160165 ] ;
161166
162167 pub fn flavors < ' b > ( & self , pkg_manager : PackageManager ) -> Option < & ' b [ Flavor ] > {
@@ -222,7 +227,9 @@ impl<'a> Template {
222227 | Template :: Angular
223228 | Template :: Preact
224229 | Template :: PreactTs => PackageManager :: NODE ,
225- Template :: Yew | Template :: Leptos | Template :: Sycamore => & [ PackageManager :: Cargo ] ,
230+ Template :: Yew | Template :: Leptos | Template :: Sycamore | Template :: Dioxus => {
231+ & [ PackageManager :: Cargo ]
232+ }
226233 Template :: Blazor => & [ PackageManager :: Dotnet ] ,
227234 }
228235 }
@@ -242,6 +249,10 @@ impl<'a> Template {
242249 matches ! ( self , Template :: Blazor )
243250 }
244251
252+ pub const fn needs_dioxus_cli ( & self ) -> bool {
253+ matches ! ( self , Template :: Dioxus )
254+ }
255+
245256 pub const fn needs_wasm32_target ( & self ) -> bool {
246257 matches ! ( self , Template :: Sycamore | Template :: Yew | Template :: Leptos )
247258 }
0 commit comments