cli foundations
This commit is contained in:
parent
50c275a4ee
commit
305c532403
11 changed files with 107 additions and 27 deletions
35
Cargo.toml
35
Cargo.toml
|
@ -1,29 +1,10 @@
|
||||||
[package]
|
[workspace]
|
||||||
|
resolver = "2"
|
||||||
|
members = [
|
||||||
|
"server",
|
||||||
|
"cli"
|
||||||
|
]
|
||||||
|
|
||||||
|
[workspace.package]
|
||||||
name = "bin"
|
name = "bin"
|
||||||
version = "0.1.0"
|
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
14
cli/Cargo.toml
Normal 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
57
cli/src/main.rs
Normal 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
28
server/Cargo.toml
Normal 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"
|
Loading…
Reference in a new issue