generated from PlexSheep/baserepo
Merge branch 'devel'
cargo devel CI / cargo CI (push) Successful in 1m54s
Details
cargo devel CI / cargo CI (push) Successful in 1m54s
Details
This commit is contained in:
commit
3bf60f86b1
17
Cargo.toml
17
Cargo.toml
|
@ -5,7 +5,7 @@ default-members = [".", "members/libpt-core"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
publish = true
|
publish = true
|
||||||
version = "0.6.0"
|
version = "0.7.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Christoph J. Scherr <software@cscherr.de>"]
|
authors = ["Christoph J. Scherr <software@cscherr.de>"]
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
@ -19,10 +19,10 @@ categories = ["command-line-utilities", "development-tools"]
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
anyhow = "1.0.79"
|
anyhow = "1.0.79"
|
||||||
thiserror = "1.0.56"
|
thiserror = "1.0.56"
|
||||||
libpt-core = { version = "0.4.0", path = "members/libpt-core" }
|
libpt-core = { version = "0.5.0", path = "members/libpt-core" }
|
||||||
libpt-bintols = { version = "0.5.1", path = "members/libpt-bintols" }
|
libpt-bintols = { version = "0.5.1", path = "members/libpt-bintols" }
|
||||||
libpt-log = { version = "0.5.1", path = "members/libpt-log" }
|
libpt-log = { version = "0.6.0", path = "members/libpt-log" }
|
||||||
libpt-cli = { version = "0.1.2", path = "members/libpt-cli" }
|
libpt-cli = { version = "0.2.1", path = "members/libpt-cli" }
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "libpt"
|
name = "libpt"
|
||||||
|
@ -41,8 +41,9 @@ categories.workspace = true
|
||||||
[features]
|
[features]
|
||||||
default = ["log", "core"]
|
default = ["log", "core"]
|
||||||
core = []
|
core = []
|
||||||
full = ["default", "core", "log", "bintols"]
|
full = ["default", "core", "log", "bintols", "libpt-cli/full"]
|
||||||
log = ["dep:libpt-log"]
|
log = ["dep:libpt-log"]
|
||||||
|
log-crate = ["libpt-cli/log"]
|
||||||
bintols = ["dep:libpt-bintols", "log"]
|
bintols = ["dep:libpt-bintols", "log"]
|
||||||
cli = ["dep:libpt-cli", "core", "log"]
|
cli = ["dep:libpt-cli", "core", "log"]
|
||||||
|
|
||||||
|
@ -58,4 +59,8 @@ crate-type = [
|
||||||
libpt-core = { workspace = true }
|
libpt-core = { workspace = true }
|
||||||
libpt-bintols = { workspace = true, optional = true }
|
libpt-bintols = { workspace = true, optional = true }
|
||||||
libpt-log = { workspace = true, optional = true }
|
libpt-log = { workspace = true, optional = true }
|
||||||
libpt-cli = { workspace = true, optional = true }
|
libpt-cli = { workspace = true, optional = true, features = ["log"] }
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
all-features = true
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
11
README.md
11
README.md
|
@ -40,12 +40,19 @@ If you want to use the python variant too, you need to compile with maturing.
|
||||||
|
|
||||||
## Installing from [pypi](https://pypi.org)
|
## Installing from [pypi](https://pypi.org)
|
||||||
|
|
||||||
`libpt` has been packaged for [pypi.org](https://pypi.org/project/libpt/).
|
The Python interface of `libpt` is currently not implemented, but it is planned
|
||||||
|
to eventually re add it. Meanwhile, you can use a much older version if you
|
||||||
|
really want.
|
||||||
|
|
||||||
You can install it with `pip install libpt`
|
> :warning: **This will install a very old version**
|
||||||
|
>
|
||||||
|
> `libpt` has been packaged for [pypi.org](https://pypi.org/project/libpt/).
|
||||||
|
>
|
||||||
|
> You can install it with `pip install libpt`
|
||||||
|
|
||||||
## Installing from [crates.io](https://crates.io)
|
## Installing from [crates.io](https://crates.io)
|
||||||
|
|
||||||
|
|
||||||
`libpt` has been packaged for [crates.io](https://crates.io/crates/libpt).
|
`libpt` has been packaged for [crates.io](https://crates.io/crates/libpt).
|
||||||
|
|
||||||
You can add the library to your project with `cargo add libpt`.
|
You can add the library to your project with `cargo add libpt`.
|
||||||
|
|
|
@ -20,3 +20,7 @@ libpt-core = { workspace = true }
|
||||||
libpt-log = { workspace = true }
|
libpt-log = { workspace = true }
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
all-features = true
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libpt-cli"
|
name = "libpt-cli"
|
||||||
publish.workspace = true
|
publish.workspace = true
|
||||||
version = "0.1.2"
|
version = "0.2.1"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
@ -12,11 +12,9 @@ repository.workspace = true
|
||||||
keywords.workspace = true
|
keywords.workspace = true
|
||||||
categories.workspace = true
|
categories.workspace = true
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
|
||||||
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
full = ["log"]
|
||||||
log = ["dep:log"]
|
log = ["dep:log"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -31,6 +29,11 @@ human-panic = "2.0.0"
|
||||||
indicatif = "0.17.8"
|
indicatif = "0.17.8"
|
||||||
libpt-log = { workspace = true, optional = false }
|
libpt-log = { workspace = true, optional = false }
|
||||||
log = { version = "0.4.21", optional = true }
|
log = { version = "0.4.21", optional = true }
|
||||||
|
serde = { version = "1.0.209", features = ["derive"] }
|
||||||
shlex = "1.3.0"
|
shlex = "1.3.0"
|
||||||
strum = { version = "0.26.3", features = ["derive"] }
|
strum = { version = "0.26.3", features = ["derive"] }
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
all-features = true
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use libpt_cli::args::VerbosityLevel;
|
use libpt_cli::args::VerbosityLevel;
|
||||||
use libpt_cli::{clap, printing};
|
use libpt_cli::printing;
|
||||||
use libpt_log::{debug, Logger};
|
use libpt_log::{debug, Logger};
|
||||||
|
|
||||||
/// This is the help
|
/// This is the help
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use console::style;
|
use console::style;
|
||||||
|
use libpt_cli::printing;
|
||||||
use libpt_cli::repl::{DefaultRepl, Repl};
|
use libpt_cli::repl::{DefaultRepl, Repl};
|
||||||
use libpt_cli::{clap, printing, strum};
|
|
||||||
use libpt_log::{debug, Logger};
|
use libpt_log::{debug, Logger};
|
||||||
|
|
||||||
use clap::Subcommand;
|
use clap::Subcommand;
|
||||||
|
@ -73,7 +73,7 @@ fn main() -> anyhow::Result<()> {
|
||||||
if !fancy {
|
if !fancy {
|
||||||
println!("{}", text.join(" "))
|
println!("{}", text.join(" "))
|
||||||
} else {
|
} else {
|
||||||
printing::blockprint(&text.join(" "), console::Color::Cyan)
|
printing::blockprint(text.join(" "), console::Color::Cyan)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ use clap::Parser;
|
||||||
use libpt_log::Level;
|
use libpt_log::Level;
|
||||||
#[cfg(feature = "log")]
|
#[cfg(feature = "log")]
|
||||||
use log;
|
use log;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Custom help template for displaying command-line usage information
|
/// Custom help template for displaying command-line usage information
|
||||||
///
|
///
|
||||||
|
@ -77,9 +78,9 @@ Author: {author-with-newline}
|
||||||
/// Get the loglevel like this:
|
/// Get the loglevel like this:
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # use libpt_cli::args::VerbosityLevel;
|
/// use libpt_cli::args::VerbosityLevel;
|
||||||
/// use libpt_log::Level;
|
/// use libpt_log::Level;
|
||||||
/// # use clap::Parser;
|
/// use clap::Parser;
|
||||||
///
|
///
|
||||||
/// # #[derive(Parser, Debug)]
|
/// # #[derive(Parser, Debug)]
|
||||||
/// # pub struct Opts {
|
/// # pub struct Opts {
|
||||||
|
@ -95,7 +96,7 @@ Author: {author-with-newline}
|
||||||
/// let level: Level = opts.verbose.level();
|
/// let level: Level = opts.verbose.level();
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Parser, Clone, PartialEq, Eq, Hash)]
|
#[derive(Parser, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||||||
pub struct VerbosityLevel {
|
pub struct VerbosityLevel {
|
||||||
/// make the output more verbose
|
/// make the output more verbose
|
||||||
#[arg(
|
#[arg(
|
||||||
|
|
|
@ -4,13 +4,3 @@
|
||||||
pub mod args;
|
pub mod args;
|
||||||
pub mod printing;
|
pub mod printing;
|
||||||
pub mod repl;
|
pub mod repl;
|
||||||
|
|
||||||
pub use clap;
|
|
||||||
pub use comfy_table;
|
|
||||||
pub use console;
|
|
||||||
pub use dialoguer;
|
|
||||||
pub use exitcode;
|
|
||||||
pub use human_panic;
|
|
||||||
pub use indicatif;
|
|
||||||
pub use shlex;
|
|
||||||
pub use strum;
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ use console::{style, Color};
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use libpt_cli::console::Color;
|
/// use console::Color;
|
||||||
/// use libpt_cli::printing::blockprint;
|
/// use libpt_cli::printing::blockprint;
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
/// blockprint("Hello world!", Color::Blue);
|
/// blockprint("Hello world!", Color::Blue);
|
||||||
|
@ -64,7 +64,7 @@ pub fn blockprint(content: impl ToString, color: Color) {
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use libpt_cli::console::Color;
|
/// use console::Color;
|
||||||
/// use libpt_cli::printing::blockfmt;
|
/// use libpt_cli::printing::blockfmt;
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
/// let formatted_content = blockfmt("Hello world!", Color::Blue);
|
/// let formatted_content = blockfmt("Hello world!", Color::Blue);
|
||||||
|
@ -93,8 +93,8 @@ pub fn blockfmt(content: impl ToString, color: Color) -> String {
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```
|
/// ```
|
||||||
/// use libpt_cli::comfy_table::{presets, CellAlignment, ContentArrangement};
|
/// use comfy_table::{presets, CellAlignment, ContentArrangement};
|
||||||
/// use libpt_cli::console::Color;
|
/// use console::Color;
|
||||||
/// use libpt_cli::printing::blockfmt_advanced;
|
/// use libpt_cli::printing::blockfmt_advanced;
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
/// println!(
|
/// println!(
|
||||||
|
|
|
@ -27,8 +27,8 @@ use libpt_log::trace;
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// use libpt_cli::repl::{DefaultRepl, Repl};
|
/// use libpt_cli::repl::{DefaultRepl, Repl};
|
||||||
/// use libpt_cli::clap::Subcommand;
|
/// use clap::Subcommand;
|
||||||
/// use libpt_cli::strum::EnumIter;
|
/// use strum::EnumIter;
|
||||||
///
|
///
|
||||||
/// #[derive(Subcommand, Debug, EnumIter, Clone)]
|
/// #[derive(Subcommand, Debug, EnumIter, Clone)]
|
||||||
/// enum ReplCommand {
|
/// enum ReplCommand {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libpt-core"
|
name = "libpt-core"
|
||||||
publish.workspace = true
|
publish.workspace = true
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
@ -14,6 +14,9 @@ categories.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.79"
|
anyhow = "1.0.79"
|
||||||
libpt-log = { workspace = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
all-features = true
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
|
@ -8,3 +8,16 @@
|
||||||
|
|
||||||
/// macros to make things faster in your code
|
/// macros to make things faster in your code
|
||||||
pub mod macros;
|
pub mod macros;
|
||||||
|
|
||||||
|
/// ## Get the name of the crate that uses your library
|
||||||
|
///
|
||||||
|
/// Let's say you're writing the library `foo` and need the name of the crate that uses `foo`. With
|
||||||
|
/// this function, you can get the name of the crate that uses `foo`.
|
||||||
|
///
|
||||||
|
/// Will return [None] if [`std::env::current_exe()`] errors or if conversion to [String] from [std::ffi::OsStr] fails.
|
||||||
|
pub fn get_crate_name() -> Option<String> {
|
||||||
|
if let Ok(exe) = std::env::current_exe() {
|
||||||
|
return Some(exe.file_stem()?.to_str()?.to_string());
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libpt-log"
|
name = "libpt-log"
|
||||||
publish.workspace = true
|
publish.workspace = true
|
||||||
version = "0.5.1"
|
version = "0.6.0"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
@ -18,6 +18,11 @@ tracing-appender = "0.2.2"
|
||||||
tracing-subscriber = "0.3.17"
|
tracing-subscriber = "0.3.17"
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
libpt-core = { workspace = true, optional = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
gag = "1.0.0"
|
gag = "1.0.0"
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
all-features = true
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
|
@ -480,5 +480,11 @@ impl Default for Logger {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_file_appender(log_dir: PathBuf) -> tracing_appender::rolling::RollingFileAppender {
|
fn new_file_appender(log_dir: PathBuf) -> tracing_appender::rolling::RollingFileAppender {
|
||||||
tracing_appender::rolling::daily(log_dir, format!("{}.log", env!("CARGO_CRATE_NAME")))
|
tracing_appender::rolling::daily(
|
||||||
|
log_dir,
|
||||||
|
format!(
|
||||||
|
"{}.log",
|
||||||
|
libpt_core::get_crate_name().unwrap_or_else(|| "logfile".to_string())
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue