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
// SPDX-License-Identifier: Apache-2.0
//! Shell integration helpers.
use clap::Subcommand;
#[derive(Clone, Copy, Debug, clap::ValueEnum, PartialEq, Eq)]
pub enum ShellKind {
Zsh,
Bash,
Fish,
}
#[derive(Clone, Copy, Debug, clap::ValueEnum, PartialEq, Eq)]
pub enum CompletionSubject {
Threads,
Markers,
}
#[derive(Subcommand, Clone)]
pub enum ShellCommands {
/// Emit a shell wrapper function on stdout. Source it from your
/// shell rc to make `heddle start`, `heddle thread switch`, and
/// `heddle thread cd` auto-`cd` into the target thread's
/// worktree.
///
/// Example install:
/// echo 'eval "$(heddle shell init zsh)"' >> ~/.zshrc
Init {
/// Shell to emit a function for.
#[arg(value_enum)]
kind: ShellKind,
},
/// Generate a shell completion script on stdout.
Completion {
/// Shell to generate completion for.
shell: String,
},
/// Print a compact prompt segment: current thread, dirty marker,
/// and remote divergence. Intended for PS1 helpers.
///
/// Example:
/// PS1='$(__heddle_ps1) '" after sourcing `heddle shell init bash`
Prompt,
}