@@ -17,6 +17,7 @@ pub struct Args {
17 pub log_file: Option<PathBuf>,
17 pub log_file: Option<PathBuf>,
18 pub config_file: Option<PathBuf>,
18 pub config_file: Option<PathBuf>,
19 pub files: Vec<(PathBuf, Position)>,
19 pub files: Vec<(PathBuf, Position)>,
20+ pub working_directory: Option<PathBuf>,
22impl Args {
23impl Args {
@@ -59,6 +60,20 @@ impl Args {
59 Some(path) => args.log_file = Some(path.into()),
60 Some(path) => args.log_file = Some(path.into()),
60 None => anyhow::bail!("--log must specify a path to write"),
61 None => anyhow::bail!("--log must specify a path to write"),
63+ "-w" | "--working-dir" => match argv.next().as_deref() {
65+ args.working_directory = if Path::new(path).is_dir() {
66+ Some(PathBuf::from(path))
69+ "--working-dir specified does not exist or is not a directory"
74+ anyhow::bail!("--working-dir must specify an initial working directory")
62 arg if arg.starts_with("--") => {
77 arg if arg.starts_with("--") => {
63 anyhow::bail!("unexpected double dash argument: {}", arg)
78 anyhow::bail!("unexpected double dash argument: {}", arg)