Update to use clap.
Structopt is deprecated. Also removed some unused dependencies.
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -1,30 +1,30 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use std::process::{Command, Stdio};
|
||||
use structopt::StructOpt;
|
||||
|
||||
pub mod gui;
|
||||
pub mod tui;
|
||||
/// Command line interface IDE with full GUI and headless modes.
|
||||
/// If no flags are provided, the GUI editor is launched in a separate process.
|
||||
/// If no path is provided, the current directory is used.
|
||||
#[derive(StructOpt, Debug)]
|
||||
#[derive(Parser, Debug)]
|
||||
#[structopt(name = "clide", verbatim_doc_comment)]
|
||||
struct Cli {
|
||||
/// The root directory for the project to open with the clide editor.
|
||||
#[structopt(parse(from_os_str))]
|
||||
#[arg(value_parser = clap::value_parser!(std::path::PathBuf))]
|
||||
pub path: Option<std::path::PathBuf>,
|
||||
|
||||
/// Run clide in headless mode.
|
||||
#[structopt(name = "tui", short, long)]
|
||||
#[arg(value_name = "tui", short, long)]
|
||||
pub tui: bool,
|
||||
|
||||
/// Run the clide GUI in the current process, blocking the terminal and showing all output streams.
|
||||
#[structopt(name = "gui", short, long)]
|
||||
#[arg(value_name = "gui", short, long)]
|
||||
pub gui: bool,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Cli::from_args();
|
||||
let args = Cli::parse();
|
||||
|
||||
let root_path = match args.path {
|
||||
// If the CLI was provided a directory, convert it to absolute.
|
||||
|
||||
Reference in New Issue
Block a user