-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
members = [ | ||
"protocol", | ||
"server", | ||
"cli" | ||
] | ||
resolver = "2" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "oxcr_cli" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
oxcr_protocol.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//! Spanned-clap, lol | ||
|
||
use std::path::PathBuf; | ||
|
||
use aott::prelude::*; | ||
use oxcr_protocol::{aott, bytes::Bytes}; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
pub enum CliSerOp { | ||
Encode, | ||
Decode, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub enum CliSerOperand { | ||
File(PathBuf), | ||
Data(Bytes), | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct CliSer { | ||
pub operation: CliSerOp, | ||
pub operand: CliSerOperand, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub enum Cli { | ||
Serialization(CliSer), | ||
} | ||
|
||
#[parser(extras = Extra)] | ||
pub fn yay(input: &str) -> Cli {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use oxcr_protocol::{ | ||
aott, | ||
miette::{self, SourceSpan}, | ||
ser::any_of, | ||
thiserror, | ||
}; | ||
|
||
#[derive(miette::Diagnostic, thiserror::Error, Debug)] | ||
pub enum ParseErrorKind { | ||
#[error("expected {expected}, found {found}")] | ||
Expected { expected: Expectation, found: char }, | ||
#[error("unexpected end of input")] | ||
UnexpectedEof, | ||
} | ||
|
||
#[derive(Debug, thiserror::Error)] | ||
pub enum Expectation { | ||
#[error("{}", any_of(.0))] | ||
AnyOf(Vec<char>), | ||
#[error("end of input")] | ||
EndOfInput, | ||
} | ||
|
||
#[derive(miette::Diagnostic, thiserror::Error, Debug)] | ||
pub struct ParseError { | ||
#[label = "here"] | ||
pub span: SourceSpan, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use oxcr_protocol::miette::Report; | ||
|
||
mod cli; | ||
mod error; | ||
|
||
fn run() -> Result<(), Report> { | ||
let mut args = std::env::args(); | ||
|
||
match args.next() { | ||
None => panic!("what"), | ||
Some(path) => { | ||
let arguments: String = args.collect(); | ||
} | ||
} | ||
} |