Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Nov 4, 2024
1 parent f666644 commit 57e2256
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 19 deletions.
1 change: 1 addition & 0 deletions v0.5/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion v0.5/fastn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ homepage.workspace = true
[dependencies]
fastn-lang.workspace = true
#fastn-static.workspace = true
#fastn-core.workspace = true
fastn-core.workspace = true
#serde.workspace = true
serde_json.workspace = true
async-trait.workspace = true
2 changes: 2 additions & 0 deletions v0.5/fastn/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
mod parse;
mod render;
mod serve;

pub use parse::parse;
pub use render::render;
pub use serve::serve;

// fastn <path> key=value
Expand Down
14 changes: 12 additions & 2 deletions v0.5/fastn/src/commands/parse.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
pub fn parse() -> Result<fastn::commands::Cli, String> {
todo!()
// does error handling
pub fn parse() -> fastn::commands::Cli {
// TODO
fastn::commands::Cli::Render {
path: "/".to_string(),
key_values: vec![],
action: fastn::Action::Read,
output: None,
browse: false,
ui: fastn::commands::UI::Terminal,
offline: false,
}
}
11 changes: 11 additions & 0 deletions v0.5/fastn/src/commands/render.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pub fn render(
_path: String,
_key_values: Vec<(String, serde_json::Value)>,
_action: fastn::Action,
_output: Option<fastn::OutputRequested>,
_browse: bool,
_ui: fastn::commands::UI,
_offline: bool,
) {
todo!()
}
1 change: 0 additions & 1 deletion v0.5/fastn/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(clippy::derive_partial_eq_without_eq, clippy::get_first)]
#![deny(unused_crate_dependencies)]
#![warn(clippy::used_underscore_binding)]

extern crate self as fastn;
Expand Down
36 changes: 21 additions & 15 deletions v0.5/fastn/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
fn main() {
let command = fastn::commands::parse();
#[expect(unused_variables)]
let ds = fastn::DS::new();
let config = fastn_core::Config::read(Box::new(fastn::DS::new()));
// read config here and pass to everyone?
// do common build stuff here
match fastn::commands::parse() {
Ok(fastn::commands::Cli::Serve {
match command {
fastn::commands::Cli::Serve {
port,
watch,
build,
offline,
}) => {
fastn::commands::serve(port, watch, build, offline);
}
Ok(fastn::commands::Cli::Render { .. }) => {}
Ok(fastn::commands::Cli::Build { .. }) => {}
Ok(fastn::commands::Cli::Static { .. }) => {}
Ok(fastn::commands::Cli::Test { .. }) => {}
Ok(fastn::commands::Cli::Fmt(_)) => {}
Ok(fastn::commands::Cli::Lint(_)) => {}
Ok(fastn::commands::Cli::Upload { .. }) => {}
Ok(fastn::commands::Cli::Clone(_)) => {}
Err(_) => {}
} => fastn::commands::serve(port, watch, build, offline),
fastn::commands::Cli::Render {
path,
key_values,
action,
output,
browse,
ui,
offline,
} => fastn::commands::render(path, key_values, action, output, browse, ui, offline),
fastn::commands::Cli::Build { .. } => {}
fastn::commands::Cli::Static { .. } => {}
fastn::commands::Cli::Test { .. } => {}
fastn::commands::Cli::Fmt(_) => {}
fastn::commands::Cli::Lint(_) => {}
fastn::commands::Cli::Upload { .. } => {}
fastn::commands::Cli::Clone(_) => {}
};
}

0 comments on commit 57e2256

Please sign in to comment.