docu things i guess

This commit is contained in:
Christoph J. Scherr 2023-09-20 20:35:07 +02:00
parent cbd0717cc6
commit 9d1a242060
11 changed files with 58 additions and 32 deletions

View File

@ -15,4 +15,16 @@ categories.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "ccc"
path = "src/ccc/mod.rs"
[[bin]]
name = "pt"
path = "src/main/mod.rs"
[dependencies]
clap = { version = "4.4.4", features = ["derive"] }
clap-num = "1.0.2"
clap-verbosity-flag = "2.0.1"
libpt = { version = "0.1.7", path = "../..", features = ["ccc", "math", "hedu", "net"] }

View File

@ -15,11 +15,10 @@
#![warn(clippy::pedantic)]
//// IMPORTS ///////////////////////////////////////////////////////////////////////////////////////
use pt::math::calculator::{*, self};
use pt::logger::*;
use libpt::ccc::*;
use libpt::log::*;
use clap::{Parser, Subcommand};
use clap_num::number_range;
use clap::Parser;
use clap_verbosity_flag::{Verbosity, InfoLevel};
use std::path::PathBuf;
@ -42,6 +41,7 @@ static LONG_ABOUT_ROOT: &'static str = r##"
"##;
//// STATICS ///////////////////////////////////////////////////////////////////////////////////////
/// defines CLI interface
#[derive(Debug, Clone, Parser)]
#[command(
author,
@ -81,12 +81,12 @@ pub struct Cli {
//// PRIVATE FUNCTIONS /////////////////////////////////////////////////////////////////////////////
fn main() {
let cli = Cli::parse();
let ll: tracing::Level = match cli.verbose.log_level().unwrap().as_str() {
"TRACE" => tracing::Level::TRACE,
"DEBUG" => tracing::Level::DEBUG,
"INFO" => tracing::Level::INFO,
"WARN" => tracing::Level::WARN,
"ERROR" => tracing::Level::ERROR,
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);

View File

@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}

View File

@ -15,11 +15,7 @@
//// IMPORTS ///////////////////////////////////////////////////////////////////////////////////////
use pt::{logger, networking::monitoring::uptime, common::*};
// we want the log macros in any case
#[allow(unused_imports)]
use tracing::{debug, error, info, trace, warn};
use libpt::{log::*, net::monitoring::uptime};
use clap::Parser;
@ -45,19 +41,19 @@ use std::path::PathBuf;
/// ## Main function of the [`pt`](crate) binary
pub fn main() {
let cli = Cli::parse();
let ll: tracing::Level = match cli.verbose.log_level().unwrap().as_str() {
"TRACE" => tracing::Level::TRACE,
"DEBUG" => tracing::Level::DEBUG,
"INFO" => tracing::Level::INFO,
"WARN" => tracing::Level::WARN,
"ERROR" => tracing::Level::ERROR,
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(EXIT_FAILURE_USAGE);
std::process::exit(1);
}
};
if cli.log_meta {
logger::Logger::init_customized(
Logger::init_customized(
false,
PathBuf::from("/dev/null"),
true,
@ -72,7 +68,7 @@ pub fn main() {
.expect("could not initialize Logger");
} else {
// less verbose version
logger::Logger::init_customized(
Logger::init_customized(
false,
PathBuf::from("/dev/null"),
true,

View File

@ -1,4 +1,7 @@
//* # Tools to work with binary values, memory, storage
//!
//! This crate is part of [`pt`](../libpt/index.html), but can also be used as a standalone
//! module.
// official binary prefixes, see [https://en.wikipedia.org/wiki/Binary_prefix]
/// 2^10

View File

@ -1,5 +1,8 @@
//! # Calculate expressions
//!
//! This crate is part of [`pt`](../libpt/index.html), but can also be used as a standalone
//! module.
//!
//! Calculate Calculations with your Calculator (`ccc`)
//!
//! This modules aim is to take a term of any kind ([String]) and calculate it's value, be it

View File

@ -1,7 +1,10 @@
//! # common functionalities
//!
//! This module implements common functionality useful for many use cases, such as macros,
//! Formatting functions and more.
//! This crate is part of [`pt`](../libpt/index.html), but can also be used as a standalone
//! module.
//!
//! This crate implements core functionality useful for many use cases, such as macros,
//! formatting functions and more.
//// ATTRIBUTES ////////////////////////////////////////////////////////////////////////////////////
// we want docs

View File

@ -1,3 +1,6 @@
fn main() {
println!("Hello, world!");
}
//! # Dump data
//!
//! This crate is part of [`pt`](../libpt/index.html), but can also be used as a standalone
//! module.
//!
//! This crate is currently empty.

View File

@ -1,5 +1,8 @@
//! # A specialized Logger for [`pt`](../libpt/index.html)
//!
//! This crate is part of [`pt`](../libpt/index.html), but can also be used as a standalone
//! module.
//!
//! For the library version, only the basic [`tracing`] is used, so that it is possible for
//! the end user to use the [`tracing`] frontend they desire.
//!

View File

@ -1,5 +1,8 @@
//! # General Mathmatics functionalities
//!
//! This crate is part of [`pt`](../libpt/index.html), but can also be used as a standalone
//! module.
//!
//! This module is currently empty, but will contain many math functionalities in a future version.
//// ATTRIBUTES ////////////////////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,8 @@
//! # various networking tools
//!
//! This crate is part of [`pt`](../libpt/index.html), but can also be used as a standalone
//! module.
//!
//! The networking module contains various tools related to connections. For example, it contains a
//! tool that has the purpose to check if your connection is consistently available.