Avril 4 years ago
parent e96f9ab8c7
commit 9290f62a26
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -10,6 +10,22 @@ pub fn program_name() -> &'static str
&NAME[..]
}
/// Print usage and exit
pub fn usage() -> !
{
println!(r#"Videl (versioning delete).
Usage: {program} [OPTIONS] <files...>
Usage: {program} --help
OPTIONS:
Compiled with:
{features}
"#, program = program_name(), features = );
std::process::exit(0)
}
#[inline] pub fn parse() -> ReportedResult<config::Config>
{
parse_as_args(std::env::args().skip(1))

@ -0,0 +1,53 @@
//! For printing features etc.
use std::{
fmt,
};
use cfg_if::cfg_if;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Enabled
{
On,
Off,
}
trait Feature
{
const DEFAULT: Enabled;
const CURRENT: Enabled;
const fn is_default() -> bool
{
Self::DEFAULT == Self::CURRENT
}
const fn is_enabled() -> bool
{
Self::CURRENT == Enabled::On
}
}
#[macro_export] macro_rules! feature {
($name:literal) => {
cfg_if!{
if #[cfg(feature=$name)] {
//TODO: create anony type that impl's Feature up threre, and such
} else {
}
}
}
}
#[derive(Debug)]
pub struct Features;
impl fmt::Display for Features
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{
//TODO: print features
}
}

@ -20,6 +20,7 @@ use error::{
use color_eyre::{
eyre::{
self,
eyre,
Result as ReportedResult,
},
};
@ -31,11 +32,21 @@ mod metadata;
mod resolve;
mod database;
mod config;
mod features;
mod args;
async fn begin() -> ReportedResult<i32>
type Pointer = *const !;
fn install() -> ReportedResult<()>
{
color_eyre::install()?;
Ok(())
}
async fn begin() -> ReportedResult<i32>
{
install()?;
Ok(0)
}

Loading…
Cancel
Save