remove the bins
cargo devel CI / cargo CI (push) Successful in 1m36s Details

This commit is contained in:
Christoph J. Scherr 2024-02-02 09:39:43 +01:00
parent 2a977fdd14
commit 7fa40416c7
Signed by: cscherrNT
GPG Key ID: 8E2B45BC51A27EA7
2 changed files with 2 additions and 114 deletions

View File

@ -49,13 +49,12 @@ keywords.workspace = true
categories.workspace = true
[features]
default = ["log", "core", "bin"]
default = ["log", "core"]
core = []
math = []
log = []
bintols = []
net = []
bin = ["dep:clap", "dep:clap-num", "dep:clap-verbosity-flag", "math", "bintols"]
[lib]
name = "libpt"
@ -65,17 +64,10 @@ crate-type = [
"rlib",
]
[[bin]]
name = "ccc"
path = "src/ccc/mod.rs"
required-features = ["bin", "math"]
[dependencies]
# FIXME: We don't want to compile all of the member crates regardless of features
libpt-core = { workspace = true }
libpt-bintols = { workspace = true }
libpt-log = { workspace = true }
libpt-math = { workspace = true }
libpt-net = { workspace = true }
clap = { version = "4.4.4", features = ["derive"], optional = true }
clap-num = { version = "1.0.2", optional = true }
clap-verbosity-flag = { version = "2.0.1", optional = true }

View File

@ -1,104 +0,0 @@
//! # Executable for the math/compute submodule
//!
//! Calculate Calculations with your Computer!
//!
//! This command line tool allows you to input a mathematical expression. It will then process the
//! expression.
//// ATTRIBUTES ////////////////////////////////////////////////////////////////////////////////////
// we want docs
#![warn(missing_docs)]
#![warn(rustdoc::missing_crate_level_docs)]
// we want Debug everywhere.
#![warn(missing_debug_implementations)]
// enable clippy's extra lints, the pedantic version
#![warn(clippy::pedantic)]
//// IMPORTS ///////////////////////////////////////////////////////////////////////////////////////
use libpt::log::*;
use clap::Parser;
use clap_verbosity_flag::{InfoLevel, Verbosity};
//// TYPES /////////////////////////////////////////////////////////////////////////////////////////
//// CONSTANTS /////////////////////////////////////////////////////////////////////////////////////
/// short about section displayed in help
const ABOUT_ROOT: &'static str = r##"
Calculate Calculations with your Computer
This commandline tool allows you to calculate complex mathematical expressions right in your
shell.
"##;
/// longer about section displayed in help, is combined with [the short help](ABOUT_ROOT)
static LONG_ABOUT_ROOT: &'static str = r##"
libpt is a personal general purpose library, offering this executable, a python module and a
dynamic library.
"##;
//// STATICS ///////////////////////////////////////////////////////////////////////////////////////
/// defines CLI interface
#[derive(Debug, Clone, Parser)]
#[command(
author,
version,
about = ABOUT_ROOT,
long_about = format!("{}{}", ABOUT_ROOT ,LONG_ABOUT_ROOT),
help_template =
r#"libpt: {version}{about-section}Author:
{author-with-newline}
{usage-heading} {usage}{all-args}{tab}"#
)]
pub struct Cli {
// clap_verbosity_flag seems to make this a global option implicitly
/// set a verbosity, multiple allowed (f.e. -vvv)
#[command(flatten)]
pub verbose: Verbosity<InfoLevel>,
/// show logger meta
#[arg(short, long, global = true)]
pub log_meta: bool,
/// your exporession(s)
#[clap(trailing_var_arg = true)]
pub expression: Vec<String>,
}
//// MACROS ////////////////////////////////////////////////////////////////////////////////////////
//// ENUMS /////////////////////////////////////////////////////////////////////////////////////////
//// STRUCTS ///////////////////////////////////////////////////////////////////////////////////////
//// IMPLEMENTATION ////////////////////////////////////////////////////////////////////////////////
//// PUBLIC FUNCTIONS //////////////////////////////////////////////////////////////////////////////
//// PRIVATE FUNCTIONS /////////////////////////////////////////////////////////////////////////////
fn main() {
let cli = Cli::parse();
let ll: Level = match cli.verbose.log_level().unwrap().as_str() {
"TRACE" => Level::TRACE,
"DEBUG" => Level::DEBUG,
"INFO" => Level::INFO,
"WARN" => Level::WARN,
"ERROR" => Level::ERROR,
_ => {
eprintln!("'{}' is not a valid loglevel", cli.verbose.to_string());
std::process::exit(1);
}
};
if cli.log_meta {
Logger::init(None, Some(ll), false).expect("could not initialize Logger");
} else {
// less verbose version
Logger::init_mini(Some(ll)).expect("could not initialize Logger");
}
let mut expr: String = String::new();
for part in cli.expression {
expr += &part;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////