Crates.io | nydus-app |
lib.rs | nydus-app |
version | 0.3.2 |
source | src |
created_at | 2021-08-15 08:57:43.375117 |
updated_at | 2023-01-31 01:58:06.520259 |
description | Application framework for Nydus Image Service |
homepage | |
repository | https://github.com/dragonflyoss/image-service |
max_upload_size | |
id | 437177 |
size | 27,171 |
The nydus-app
crate is a collection of utilities to help creating applications for Nydus Image Service
project, which provides:
struct BuildTimeInfo
: application build and version information.fn dump_program_info()
: dump program build and version information.fn setup_logging()
: setup logging infrastructure for application.Platforms:
Operating Systems:
Add nydus-app
as a dependency in Cargo.toml
[dependencies]
nydus-app = "*"
Then add extern crate nydus-app;
to your crate root if needed.
#[macro_use(crate_authors, crate_version)]
extern crate clap;
use clap::App;
use std::io::Result;
use nydus_app::{BuildTimeInfo, setup_logging};
fn main() -> Result<()> {
let level = cmd.value_of("log-level").unwrap().parse().unwrap();
let (bti_string, build_info) = BuildTimeInfo::dump();
let _cmd = App::new("")
.version(bti_string.as_str())
.author(crate_authors!())
.get_matches();
setup_logging(None, level)?;
print!("{}", build_info);
Ok(())
}
This code is licensed under Apache-2.0.