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
//! CLI argument definitions for Trail.
//!
//! Defines the `clap`-based command-line interface: `--cwd-file` (consumed by
//! Phase 6's shell integration), `--config` (consumed by Phase 7's config
//! loading), and an optional positional start path.
use clap::Parser;
use std::path::PathBuf;
/// Trail — a terminal file manager.
#[derive(Parser, Debug)]
#[command(name = "trail", version = crate::version::LONG_VERSION, about = "A terminal file manager")]
pub struct Cli {
/// Path to write the final working directory on normal exit.
///
/// Used by shell wrapper functions to `cd` into the last-browsed
/// directory after Trail exits. If omitted, no file is written.
#[arg(long)]
pub cwd_file: Option<PathBuf>,
/// Path to a TOML configuration file.
///
/// The path is remembered, so a later `trail` with no `--config` reloads
/// the same file. If nothing has ever been loaded, Trail uses its
/// built-in defaults.
#[arg(long)]
pub config: Option<PathBuf>,
/// Ignore the remembered `--config` file and use the built-in defaults.
///
/// Affects this run only; the remembered path is left in place, so a
/// later bare `trail` picks it up again.
#[arg(long, conflicts_with = "config")]
pub no_config: bool,
/// Print every file and directory Trail uses, then exit.
///
/// Reports the binary, config and data directories, the log file and any
/// shell wrappers found, each marked with whether it exists. The locations
/// are platform-dependent and not guessable, so this is what the uninstall
/// documentation and scripts point at.
#[arg(long)]
pub paths: bool,
/// Starting directory. Defaults to the current working directory.
#[arg(default_value = ".")]
pub start_path: PathBuf,
}