1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use clap::Clap;
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
use std::fs::canonicalize;
use std::sync::mpsc::channel;
use std::time::Duration;
use super::Platform;
use crate::ios::simctl;
#[derive(Clap)]
pub struct Watch {
#[clap(subcommand)]
platform: Platform,
}
impl Watch {
pub fn main(&self) {
let _ = self.platform;
let mut simctl = simctl::Simctl::new();
let manager = simctl.list().unwrap();
let _device = super::run::select_device(&manager);
let (tx, rx) = channel();
let mut watcher = watcher(tx, Duration::from_millis(1000)).unwrap();
watcher.watch(".", RecursiveMode::Recursive).unwrap();
let target = canonicalize("target/").unwrap();
loop {
match rx.recv() {
Ok(event) => match event {
DebouncedEvent::NoticeWrite(path) if !path.starts_with(&target) => {
super::run::build_cargo();
unimplemented!();
}
_ => {}
},
Err(_) => break,
}
}
}
}