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
49
50
51
52
53
54
55
56
57
58
use clap::{ArgAction, Args, ValueHint};
use std::path::PathBuf;
#[derive(Args, Debug)]
pub(crate) struct HeadlessArgs {
#[command(flatten)]
pub(crate) r_source: super::shared::RSourceArgs,
/// Bind IPC socket to a specific path instead of the default.
/// On Unix, ensure the parent directory is user-private (mode 0700)
/// to avoid a brief permission window before the socket is restricted.
///
/// Unix: filesystem path (e.g. /tmp/my-arf.sock)
/// Windows: named pipe path (e.g. \\.\pipe\my-arf)
// NOTE: FilePath is not ideal on Windows (named pipes aren't filesystem
// paths), but using cfg_attr to vary the hint per platform would cause
// shell completion snapshots to differ across machines.
#[arg(long = "ipc-bind", value_hint = ValueHint::FilePath)]
pub(crate) bind: Option<String>,
/// Write server PID to a file (removed on shutdown)
#[arg(long = "ipc-pid-file", value_hint = ValueHint::FilePath)]
pub(crate) pid_file: Option<PathBuf>,
/// Add an exact function target to the IPC evaluate allowlist. May be
/// repeated; package-qualified targets use `package::function`.
#[arg(
long = "ipc-eval-allow-function",
action = ArgAction::Append
)]
pub(crate) ipc_eval_allow_function: Vec<String>,
/// Disable the IPC evaluate allowlist for this server startup only.
#[arg(long = "ipc-eval-unrestricted")]
pub(crate) ipc_eval_unrestricted: bool,
/// Suppress status messages on stderr (IPC path, ready, shutdown)
#[arg(long)]
pub(crate) quiet: bool,
/// Print session info as JSON to stdout when ready
///
/// Outputs a JSON object with pid, socket_path, r_version, etc.
/// Implies --quiet (suppresses status messages on stderr).
/// Pretty-printed when stdout is a terminal, compact when piped.
#[arg(long)]
pub(crate) json: bool,
/// Redirect log output to a file instead of stderr
#[arg(long = "log-file", value_hint = ValueHint::FilePath)]
pub(crate) log_file: Option<PathBuf>,
#[command(flatten)]
pub(crate) r_compat: super::shared::RCompatArgs,
#[command(flatten)]
pub(crate) history: super::shared::HistoryOptions,
}