reactive_graph_tooling/tooling/instances/
args.rs1use crate::tooling::instances::commands::InstancesCommands;
2use crate::tooling::instances::provisioning::Chown;
3use clap::Parser;
4use std::path::PathBuf;
5
6#[derive(Parser, Debug)]
7pub struct InstancesArgs {
8 pub working_directory: Option<PathBuf>,
11
12 #[command(subcommand)]
13 pub commands: InstancesCommands,
14}
15
16#[derive(Parser, Debug)]
17pub struct ChownArgs {
18 #[cfg(target_os = "linux")]
20 #[arg(long)]
21 pub uid: Option<u32>,
22
23 #[cfg(target_os = "linux")]
25 #[arg(long)]
26 pub gid: Option<u32>,
27}
28
29impl ChownArgs {
30 pub fn get_chown(&self) -> Option<Chown> {
31 #[cfg(target_os = "linux")]
32 if let (Some(uid), Some(gid)) = (self.uid, self.gid) {
33 return Some(Chown::new(uid, gid));
34 };
35 None
36 }
37}
38
39impl Default for ChownArgs {
40 #[cfg(target_os = "linux")]
41 fn default() -> Self {
42 Self { uid: None, gid: None }
43 }
44 #[cfg(not(target_os = "linux"))]
45 fn default() -> Self {
46 Self {}
47 }
48}