File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' tauri-cli ' : ' patch:bug'
3+ ' @tauri-apps/cli ' : ' patch:bug'
4+ ---
5+
6+ Ensure ` tauri add ` prints ` rust_code ` with plugin name in snake case.
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ pub struct Options {
3434
3535pub fn command ( options : Options ) -> Result < ( ) > {
3636 let plugin = options. plugin ;
37+ let plugin_snake_case = plugin. replace ( '-' , "_" ) ;
3738 let crate_name = format ! ( "tauri-plugin-{plugin}" ) ;
3839 let npm_name = format ! ( "@tauri-apps/plugin-{plugin}" ) ;
3940
@@ -111,7 +112,7 @@ pub fn command(options: Options) -> Result<()> {
111112 r#"tauri::Builder::default()
112113 .setup(|app| {{
113114 #[cfg(desktop)]
114- app.handle().plugin(tauri_plugin_{plugin }::Builder::new().build());
115+ app.handle().plugin(tauri_plugin_{plugin_snake_case }::Builder::new().build());
115116 Ok(())
116117 }})
117118 "# ,
@@ -120,7 +121,7 @@ pub fn command(options: Options) -> Result<()> {
120121 format ! (
121122 r#"tauri::Builder::default()
122123 .setup(|app| {{
123- app.handle().plugin(tauri_plugin_{plugin }::Builder::new().build());
124+ app.handle().plugin(tauri_plugin_{plugin_snake_case }::Builder::new().build());
124125 Ok(())
125126 }})
126127 "# ,
@@ -131,14 +132,14 @@ pub fn command(options: Options) -> Result<()> {
131132 r#"tauri::Builder::default()
132133 .setup(|app| {{
133134 #[cfg(desktop)]
134- app.handle().plugin(tauri_plugin_{plugin }::init());
135+ app.handle().plugin(tauri_plugin_{plugin_snake_case }::init());
135136 Ok(())
136137 }})
137138 "# ,
138139 )
139140 } else {
140141 format ! (
141- r#"tauri::Builder::default().plugin(tauri_plugin_{plugin }::init())
142+ r#"tauri::Builder::default().plugin(tauri_plugin_{plugin_snake_case }::init())
142143 "# ,
143144 )
144145 } ;
You can’t perform that action at this time.
0 commit comments