diff --git a/plugins/forc-index/src/commands/deploy.rs b/plugins/forc-index/src/commands/deploy.rs index ad44fc0b0..1ec17d1e7 100644 --- a/plugins/forc-index/src/commands/deploy.rs +++ b/plugins/forc-index/src/commands/deploy.rs @@ -3,7 +3,7 @@ use anyhow::Result; use clap::Parser; use std::path::PathBuf; -/// Create a new Forc project in an existing directory. +/// Deploy an index asset bundle to a remote or locally running indexer server. #[derive(Debug, Parser)] pub struct Command { /// URL at which to upload index assets diff --git a/plugins/forc-index/src/commands/init.rs b/plugins/forc-index/src/commands/init.rs index baf64c9ea..b366d249d 100644 --- a/plugins/forc-index/src/commands/init.rs +++ b/plugins/forc-index/src/commands/init.rs @@ -3,7 +3,7 @@ use anyhow::Result; use clap::Parser; use std::path::PathBuf; -/// Create a new Forc project in the current directory. +/// Create a new indexer project in the current directory. #[derive(Debug, Parser)] pub struct Command { /// Name of index diff --git a/plugins/forc-index/src/commands/new.rs b/plugins/forc-index/src/commands/new.rs index ad0913a10..e6b1206bc 100644 --- a/plugins/forc-index/src/commands/new.rs +++ b/plugins/forc-index/src/commands/new.rs @@ -3,7 +3,7 @@ use anyhow::Result; use clap::Parser; use std::path::PathBuf; -/// Create a new Forc project in an existing directory. +/// Create a new indexer project in a new directory. #[derive(Debug, Parser)] pub struct Command { /// Name of index diff --git a/plugins/forc-index/src/commands/start.rs b/plugins/forc-index/src/commands/start.rs index 0f30e0334..d31b6e875 100644 --- a/plugins/forc-index/src/commands/start.rs +++ b/plugins/forc-index/src/commands/start.rs @@ -3,7 +3,7 @@ use anyhow::Result; use clap::Parser; use std::path::PathBuf; -/// Create a new Forc project in an existing directory. +/// Start a local indexer service. #[derive(Debug, Parser)] pub struct Command { /// Log level passed to the Fuel Indexer service. diff --git a/plugins/forc-index/src/ops/forc_index_deploy.rs b/plugins/forc-index/src/ops/forc_index_deploy.rs index 65e40487d..83b406d28 100644 --- a/plugins/forc-index/src/ops/forc_index_deploy.rs +++ b/plugins/forc-index/src/ops/forc_index_deploy.rs @@ -1,4 +1,4 @@ -use crate::cli::DeployCommand; +use crate::{cli::DeployCommand, utils::extract_manifest_fields}; use reqwest::{ blocking::{multipart::Form, Client}, header::{HeaderMap, AUTHORIZATION}, @@ -10,45 +10,6 @@ use std::io::{BufReader, Read}; use std::path::Path; use tracing::{error, info}; -fn extract_manifest_fields( - manifest: serde_yaml::Value, -) -> anyhow::Result<(String, String, String, String)> { - let namespace: String = manifest - .get(&serde_yaml::Value::String("namespace".into())) - .unwrap() - .as_str() - .unwrap() - .to_string(); - let identifier: String = manifest - .get(&serde_yaml::Value::String("identifier".into())) - .unwrap() - .as_str() - .unwrap() - .to_string(); - let graphql_schema: String = manifest - .get(&serde_yaml::Value::String("graphql_schema".into())) - .unwrap() - .as_str() - .unwrap() - .to_string(); - let module: serde_yaml::Value = manifest - .get(&serde_yaml::Value::String("module".into())) - .unwrap() - .to_owned(); - let module_path: String = module - .get(&serde_yaml::Value::String("wasm".into())) - .unwrap_or_else(|| { - module - .get(&serde_yaml::Value::String("native".into())) - .unwrap() - }) - .as_str() - .unwrap() - .to_string(); - - Ok((namespace, identifier, graphql_schema, module_path)) -} - pub fn init(command: DeployCommand) -> anyhow::Result<()> { let mut manifest_file = fs::File::open(&command.manifest).unwrap_or_else(|_| { panic!(