mod.rs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. use super::*;
  2. /// Build the Rust WASM app and all of its assets.
  3. #[derive(Clone, Debug, Deserialize, Subcommand)]
  4. #[clap(name = "plugin")]
  5. pub enum Plugin {
  6. /// Return all dioxus-cli support tools.
  7. List {},
  8. /// Get default app install path.
  9. AppPath {},
  10. /// Install a new tool.
  11. Add { name: String },
  12. }
  13. impl Plugin {
  14. pub async fn plugin(self) -> Result<()> {
  15. match self {
  16. Plugin::List {} => {
  17. for item in crate::plugin::PluginManager::plugin_list() {
  18. println!("- {item}");
  19. }
  20. }
  21. Plugin::AppPath {} => {
  22. let plugin_dir = crate::plugin::PluginManager::init_plugin_dir();
  23. if let Some(v) = plugin_dir.to_str() {
  24. println!("{}", v);
  25. } else {
  26. log::error!("Plugin path get failed.");
  27. }
  28. }
  29. Plugin::Add { name: _ } => {
  30. log::info!("You can use `dioxus plugin app-path` to get Installation position");
  31. }
  32. }
  33. Ok(())
  34. }
  35. }