Skip to main content

cfsctl/
main.rs

1//! Command-line control utility for composefs repositories and images.
2//!
3//! `cfsctl` provides a comprehensive interface for managing composefs repositories,
4//! creating and mounting filesystem images, handling OCI containers, and performing
5//! repository maintenance operations like garbage collection.
6
7use composefs_ctl::App;
8
9use anyhow::Result;
10use clap::Parser;
11
12fn main() -> Result<()> {
13    // If we were spawned as a userns helper process, handle that and exit.
14    // This MUST be called before the tokio runtime is created.
15    #[cfg(feature = "containers-storage")]
16    cstorage::init_if_helper();
17
18    // Now we can create the tokio runtime for the main application
19    tokio::runtime::Builder::new_multi_thread()
20        .enable_all()
21        .build()?
22        .block_on(async_main())
23}
24
25async fn async_main() -> Result<()> {
26    env_logger::init();
27
28    let args = App::parse();
29    composefs_ctl::run_app(args).await
30}