[examples] proper dir for examples
Signed-off-by: Luca Fulchir <luca.fulchir@runesauth.com>
This commit is contained in:
parent
7beea1a36b
commit
8cbf868760
@ -15,16 +15,25 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mod conf;
|
//!
|
||||||
//mod expanded;
|
//! Example of two package repositories, where one
|
||||||
mod repos;
|
//! extends ancd changes another
|
||||||
|
|
||||||
|
// all packages we have
|
||||||
|
pub mod pkgs;
|
||||||
|
|
||||||
|
pub mod r1;
|
||||||
|
pub mod r2;
|
||||||
|
|
||||||
|
pub use r1::R1;
|
||||||
|
pub use r2::R2;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
//let one = repos::pkgs::one::One::default();
|
//let one = repos::pkgs::one::One::default();
|
||||||
|
|
||||||
use ::std::sync::Arc;
|
use ::std::sync::Arc;
|
||||||
let pkgs1 = Arc::new(repos::R1::default());
|
let pkgs1 = Arc::new(R1::default());
|
||||||
let pkgs2 = Arc::new(repos::R2::default());
|
let pkgs2 = Arc::new(R2::default());
|
||||||
use ::bok::Repository;
|
use ::bok::Repository;
|
||||||
println!("pkgs1: {}", pkgs1.name());
|
println!("pkgs1: {}", pkgs1.name());
|
||||||
println!("pkgs2: {}", pkgs2.name());
|
println!("pkgs2: {}", pkgs2.name());
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
/// Example package
|
/// Example package
|
||||||
#[::bok::package(::bok::PkgEmpty)]
|
#[::bok::package(::bok::PkgEmpty)]
|
||||||
#[::bok::deps(crate::repos::pkgs::One)]
|
#[::bok::deps(crate::pkgs::One)]
|
||||||
pub struct Three {
|
pub struct Three {
|
||||||
pub my_attr: u32,
|
pub my_attr: u32,
|
||||||
}
|
}
|
@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/// Example package
|
/// Example package
|
||||||
#[::bok::package(crate::repos::pkgs::one::One)]
|
#[::bok::package(crate::pkgs::one::One)]
|
||||||
#[::bok::deps(crate::repos::pkgs::one::One)]
|
#[::bok::deps(crate::pkgs::one::One)]
|
||||||
pub struct Two {
|
pub struct Two {
|
||||||
my_attr2: u32,
|
my_attr2: u32,
|
||||||
}
|
}
|
@ -19,7 +19,7 @@
|
|||||||
//! Example of a simple repository of packages
|
//! Example of a simple repository of packages
|
||||||
|
|
||||||
// get the 'pkgs' from somewhere
|
// get the 'pkgs' from somewhere
|
||||||
use crate::repos::pkgs;
|
use crate::pkgs;
|
||||||
|
|
||||||
/* or you can create and export your own packages
|
/* or you can create and export your own packages
|
||||||
pub mod pkgs {
|
pub mod pkgs {
|
@ -24,10 +24,10 @@ use ::bok::repository;
|
|||||||
|
|
||||||
pub mod pkgs {
|
pub mod pkgs {
|
||||||
pub mod one {
|
pub mod one {
|
||||||
pub use crate::repos::pkgs::one::*;
|
pub use crate::pkgs::one::*;
|
||||||
}
|
}
|
||||||
pub mod two {
|
pub mod two {
|
||||||
pub use crate::repos::pkgs::two::*;
|
pub use crate::pkgs::two::*;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,15 +15,27 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//!
|
use ::clap::Parser;
|
||||||
//! Example of two package repositories, where one
|
|
||||||
//! extends ancd changes another
|
|
||||||
|
|
||||||
// all packages we have
|
/// Simple program to greet a person
|
||||||
pub mod pkgs;
|
#[derive(::clap::Parser, Debug)]
|
||||||
|
#[command(version, about, long_about = None)]
|
||||||
|
struct Args {
|
||||||
|
/// subcommand
|
||||||
|
#[command(subcommand)]
|
||||||
|
command: Commands,
|
||||||
|
}
|
||||||
|
|
||||||
pub mod r1;
|
/// Available subcommands for `bok`
|
||||||
pub mod r2;
|
#[derive(Debug, ::clap::Subcommand)]
|
||||||
|
enum Commands {
|
||||||
|
/// Build
|
||||||
|
Build {
|
||||||
|
#[arg(long, short)]
|
||||||
|
path: Option<::std::ffi::OsString>,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
pub use r1::R1;
|
fn main() {
|
||||||
pub use r2::R2;
|
let args = Args::parse();
|
||||||
|
}
|
@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2024 Luca Fulchir <luca.fulchir@runesauth.com>
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 with LLVM exception (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License and of the exception at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* https://spdx.org/licenses/LLVM-exception.html
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static CONF: ::bok::Conf = ::bok::Conf {};
|
|
||||||
|
|
||||||
mod conf {
|
|
||||||
static CONF: ::bok::Conf = ::bok::Conf {};
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user