railwayapp 0.0.8

Interact with Railway via CLI
use anyhow::bail;

use crate::consts::ABORTED_BY_USER;

use super::*;

/// Open Railway Documentation in default browser
#[derive(Parser)]
pub struct Args {}

pub async fn command(_args: Args, _json: bool) -> Result<()> {
    let config = Configs::new()?;
    let confirm = inquire::Confirm::new("Open the browser")
        .with_default(true)
        .with_render_config(config.get_render_config())
        .prompt()?;

    if !confirm {
        bail!(ABORTED_BY_USER);
    }

    ::open::that("https://docs.railway.app/")?;
    Ok(())
}