pub async fn start(cli: GooseberryCLI) -> color_eyre::Result<()> {
        if let GooseberrySubcommand::Config { cmd } = &cli.cmd {
            return ConfigCommand::run(cmd, cli.config.as_deref()).await;
        }
        if let GooseberrySubcommand::Complete { shell } = &cli.cmd {
            GooseberryCLI::complete(*shell);
            return Ok(());
        }
        // Reads the GOOSEBERRY_CONFIG environment variable to get config file location
        let config = GooseberryConfig::load(cli.config.as_deref()).await?;
        let api = Hypothesis::new(
            config
                .hypothesis_username
                .as_deref()
                .ok_or(Apologize::ConfigError {
                    message: "Hypothesis username isn't stored".into(),
                })?,
            config
                .hypothesis_key
                .as_deref()
                .ok_or(Apologize::ConfigError {
                    message: "Hypothesis developer API key isn't stored".into(),
                })?,
        )?;
        let mut gooseberry = Self {
            db: Self::get_db(&config.db_dir)?,
            api,
            config,
        };
        gooseberry.set_merge()?;
        gooseberry.run(cli).await?;
        Ok(())
    }
/// Initialize program with command line input.
/// Reads `sled` trees and metadata file from the locations specified in config.
/// (makes new ones the first time).
Initialize program with command line input.
Reads `sled` trees and metadata file from the locations specified in config.
(makes new ones the first time).
Initialize program with command line input . Reads ` sled ` trees and metadata file from the locations specified in config . ( makes new ones the first time ) .
pub async fn start(cli: GooseberryCLI) -> color_eyre::Result<()> {
        if let GooseberrySubcommand::Config { cmd } = &cli.cmd {
            return ConfigCommand::run(cmd, cli.config.as_deref()).await;
        }
        if let GooseberrySubcommand::Complete { shell } = &cli.cmd {
            GooseberryCLI::complete(*shell);
            return Ok(());
        }
        // Reads the GOOSEBERRY_CONFIG environment variable to get config file location
        let config = GooseberryConfig::load(cli.config.as_deref()).await?;
        let api = Hypothesis::new(
            config
                .hypothesis_username
                .as_deref()
                .ok_or(Apologize::ConfigError {
                    message: "Hypothesis username isn't stored".into(),
                })?,
            config
                .hypothesis_key
                .as_deref()
                .ok_or(Apologize::ConfigError {
                    message: "Hypothesis developer API key isn't stored".into(),
                })?,
        )?;
        let mut gooseberry = Self {
            db: Self::get_db(&config.db_dir)?,
            api,
            config,
        };
        gooseberry.set_merge()?;
        gooseberry.run(cli).await?;
        Ok(())
    }
pub async fn start ( cli : GooseberryCLI ) -> color_eyre :: Result < ( ) > { if let GooseberrySubcommand :: Config { cmd } = & cli . cmd { return ConfigCommand :: run ( cmd , cli . config . as_deref ( ) ) . await ; } if let GooseberrySubcommand :: Complete { shell } = & cli . cmd { GooseberryCLI :: complete ( * shell ) ; return Ok ( ( ) ) ; } // Reads the GOOSEBERRY_CONFIG environment variable to get config file location let config = GooseberryConfig :: load ( cli . config . as_deref ( ) ) . await ? ; let api = Hypothesis :: new ( config . hypothesis_username . as_deref ( ) . ok_or ( Apologize :: ConfigError { message : " " . into ( ) , } ) ? , config . hypothesis_key . as_deref ( ) . ok_or ( Apologize :: ConfigError { message : " " . into ( ) , } ) ? , ) ? ; let mut gooseberry = Self { db : Self :: get_db ( & config . db_dir ) ? , api , config , } ; gooseberry . set_merge ( ) ? ; gooseberry . run ( cli ) . await ? ; Ok ( ( ) ) }
Initialize program with command line input.
Initialize program with command line input .
cli
GooseberryCLI
cli
GooseberryCLI