Skip to content

Commit

Permalink
System send Process instead of Entity
Browse files Browse the repository at this point in the history
  • Loading branch information
dragazo committed Nov 13, 2023
1 parent 7114722 commit e98d8e8
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 150 deletions.
12 changes: 8 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ fn run_proj_tty<C: CustomTypes<StdSystem<C>>>(project_name: &str, server: String
let config = overrides.fallback(&Config {
command: {
let update_flag = update_flag.clone();
Some(Rc::new(move |_, _, key, command, entity| match command {
Some(Rc::new(move |_, _, key, command, proc| match command {
Command::Print { style: _, value } => {
let entity = &*proc.current_entity().borrow();
if let Some(value) = value {
print!("{entity:?} > {value:?}\r\n");
update_flag.set(true);
Expand All @@ -204,8 +205,9 @@ fn run_proj_tty<C: CustomTypes<StdSystem<C>>>(project_name: &str, server: String
request: {
let update_flag = update_flag.clone();
let input_queries = input_queries.clone();
Some(Rc::new(move |_, _, key, request, entity| match request {
Some(Rc::new(move |_, _, key, request, proc| match request {
Request::Input { prompt } => {
let entity = &*proc.current_entity().borrow();
input_queries.borrow_mut().push_back((format!("{entity:?} {prompt:?} > "), key));
update_flag.set(true);
RequestStatus::Handled
Expand Down Expand Up @@ -297,8 +299,9 @@ fn run_proj_tty<C: CustomTypes<StdSystem<C>>>(project_name: &str, server: String
fn run_proj_non_tty<C: CustomTypes<StdSystem<C>>>(project_name: &str, server: String, role: &ast::Role, overrides: Config<C, StdSystem<C>>, clock: Arc<Clock>) {
let config = overrides.fallback(&Config {
request: None,
command: Some(Rc::new(move |_, _, key, command, entity| match command {
command: Some(Rc::new(move |_, _, key, command, proc| match command {
Command::Print { style: _, value } => {
let entity = &*proc.current_entity().borrow();
if let Some(value) = value { println!("{entity:?} > {value:?}") }
key.complete(Ok(()));
CommandStatus::Handled
Expand Down Expand Up @@ -382,8 +385,9 @@ fn run_server<C: CustomTypes<StdSystem<C>>>(nb_server: String, addr: String, por
let weak_state = Arc::downgrade(&state);
let config = overrides.fallback(&Config {
request: None,
command: Some(Rc::new(move |_, _, key, command, entity| match command {
command: Some(Rc::new(move |_, _, key, command, proc| match command {
Command::Print { style: _, value } => {
let entity = &*proc.current_entity().borrow();
if let Some(value) = value { tee_println!(weak_state.upgrade() => "{entity:?} > {value:?}") }
key.complete(Ok(()));
CommandStatus::Handled
Expand Down
Loading

0 comments on commit e98d8e8

Please sign in to comment.