cli foundations

This commit is contained in:
Paul Zinselmeyer 2023-10-20 00:04:42 +02:00
parent 9daacaf406
commit 3dfb2d7ad5
11 changed files with 107 additions and 27 deletions

View file

@ -1,29 +1,10 @@
[package]
[workspace]
resolver = "2"
members = [
"server",
"cli"
]
[workspace.package]
name = "bin"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1.33", features = ["full"] }
tokio-util = { version="0.7", features = ["io"]}
futures-util = "0.3"
axum = {version="0.6", features=["macros", "headers", "multipart"]}
serde = "1.0"
toml = "0.8"
duration-str = "0.7.0"
render = { git="https://github.com/render-rs/render.rs" }
thiserror = "1.0"
rand = "0.8"
dotenvy = "0.15"
markdown = "0.3"
axum_oidc = {git="https://git2.zettoit.eu/pfz4/axum_oidc"}
log = "0.4"
env_logger = "0.10"
chacha20 = "0.9"
sha3 = "0.10"
hex = "0.4"
bytes = "1.5"
pin-project-lite = "0.2"

14
cli/Cargo.toml Normal file
View file

@ -0,0 +1,14 @@
[package]
name = "binctl"
edition = "2021"
version.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version="4.4", features = ["derive"] }
reqwest = { version="0.11", features = ["rustls-tls", "stream"], default-features=false}
openidconnect = "3.4"
thiserror = "1.0"
confy = "0.5"
serde = { version="1.0", features = [ "derive" ] }

57
cli/src/main.rs Normal file
View file

@ -0,0 +1,57 @@
use std::path::PathBuf;
use clap::{Parser, Subcommand};
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct Config {
server: String,
client_id: String,
client_secret: String,
claims: Vec<String>,
challenge_port: u32,
}
#[derive(Debug, Parser)]
pub struct Args {
#[arg(short, long, value_name = "FILE")]
config: Option<PathBuf>,
#[command(subcommand)]
command: Option<Command>,
}
#[derive(Debug, Subcommand)]
pub enum Command {
Create {
#[arg(short, long, action)]
stdin: bool,
},
Upload {},
Login {
/// challenge port to listen to
#[arg(short, long, value_name = "PORT")]
port: Option<u32>,
/// OIDC server
#[arg(long, value_name = "URL")]
server: Option<String>,
/// OIDC client id
#[arg(long)]
client: Option<String>,
/// OIDC client secret
#[arg(long)]
secret: Option<String>,
/// OIDC claims
#[arg(long)]
claims: Option<Vec<String>>,
},
}
fn main() {
let args = Args::parse();
dbg!(args);
}

28
server/Cargo.toml Normal file
View file

@ -0,0 +1,28 @@
[package]
name = "bin"
version.workspace = true
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1.33", features = ["full"] }
tokio-util = { version="0.7", features = ["io"]}
futures-util = "0.3"
axum = {version="0.6", features=["macros", "headers", "multipart"]}
serde = "1.0"
toml = "0.8"
render = { git="https://github.com/render-rs/render.rs" }
thiserror = "1.0"
rand = "0.8"
dotenvy = "0.15"
markdown = "0.3"
axum_oidc = {git="https://git2.zettoit.eu/pfz4/axum_oidc"}
log = "0.4"
env_logger = "0.10"
chacha20 = "0.9"
sha3 = "0.10"
hex = "0.4"
bytes = "1.5"
pin-project-lite = "0.2"