vertigo_cli/watch/
watch_opts.rs1use clap::Args;
2
3use crate::build::{BuildOpts, BuildOptsInner};
4use crate::commons::models::CommonOpts;
5use crate::serve::ServeOptsInner;
6use crate::ServeOpts;
7
8#[derive(Args, Debug, Clone)]
9pub struct WatchOpts {
10
11 #[arg(long, default_value_t = {5555})]
12 pub port_watch: u16,
13
14 #[arg(long)]
16 pub add_watch_path: Vec<String>,
17
18 #[arg(long, default_value_t = {".gitignore".to_string()}, hide_short_help(true))]
20 pub watch_ignore_lists: String,
21
22 #[arg(long, default_value_t = {"**/*.swp **/*.swx **/*.rs.bk".to_string()}, hide_short_help(true))]
24 pub global_ignores: String,
25
26 #[clap(flatten)]
27 pub serve: ServeOptsInner,
28
29 #[clap(flatten)]
30 pub build: BuildOptsInner,
31
32 #[clap(flatten)]
33 pub common: CommonOpts,
34}
35
36impl WatchOpts {
37 pub fn to_build_opts(&self) -> BuildOpts {
38 BuildOpts {
39 common: self.common.clone(),
40 inner: self.build.clone(),
41 }
42 }
43
44 pub fn to_serve_opts(&self) -> (ServeOpts, u16) {
45 (
46 ServeOpts {
47 common: self.common.clone(),
48 inner: self.serve.clone(),
49 },
50 self.port_watch,
51 )
52 }
53}