1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::ops::forc_index_new;
use anyhow::Result;
use clap::Parser;
use std::path::PathBuf;

/// Create a new indexer project in a new directory.
#[derive(Debug, Parser)]
pub struct Command {
    /// Path at which to create indexer.
    pub path: PathBuf,

    /// Name of indexer.
    #[clap(long, help = "Name of indexer.")]
    pub name: Option<String>,

    /// Namespace to which indexer belongs.
    #[clap(long, help = "Namespace to which indexer belongs.")]
    pub namespace: Option<String>,

    /// Resolve indexer asset filepaths using absolute paths.
    #[clap(long, help = "Resolve indexer asset filepaths using absolute paths.")]
    pub absolute_paths: bool,

    /// Enable verbose output.
    #[clap(short, long, help = "Enable verbose output.")]
    pub verbose: bool,
}

pub fn exec(command: Command) -> Result<()> {
    forc_index_new::init(command)?;
    Ok(())
}