rsvim_core 0.1.3-alpha.2

The core library for RSVIM text editor.
Documentation
//! Command line options.

use crate::prelude::*;
use clap::Parser;

const ABOUT: &str = "RSVIM - The VIM editor reinvented in Rust+TypeScript";

#[derive(Debug, Clone, Parser)]
#[command(
  disable_version_flag = true,
  about = ABOUT,
)]
/// Command line options.
pub struct CliOptions {
  #[arg(short = 'V', long = "version", help = "Print version")]
  version: bool,

  #[arg(help = "Edit file(s)")]
  // Files
  file: Vec<PathBuf>,
}

impl CliOptions {
  /// version.
  pub fn version(&self) -> bool {
    self.version
  }

  /// Input files.
  pub fn file(&self) -> &Vec<PathBuf> {
    &self.file
  }

  #[cfg(test)]
  pub fn new(version: bool, file: Vec<PathBuf>) -> Self {
    Self { version, file }
  }

  #[cfg(test)]
  pub fn empty() -> Self {
    Self {
      version: false,
      file: vec![],
    }
  }
}