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
//! Shell auto-completion generator workflow (`git claw completion <shell>`).
//!
//! Generates auto-completion scripts for various shells (Bash, Fish, Zsh, PowerShell, Elvish).
use crateCli;
use crateWorkflowError;
use CommandFactory;
use ;
use Write;
/// Generates shell completion script and writes it to the provided writer.
///
/// :param shell: Target shell (e.g., Fish, Bash, Zsh).
/// :param writer: Destination stream implementing [`Write`].
///
/// # Example
///
/// ```
/// use clap_complete::Shell;
/// use git_claw::workflow::completion::generate_completion;
///
/// let mut buffer = Vec::new();
/// generate_completion(Shell::Fish, &mut buffer);
/// let output = String::from_utf8(buffer).expect("valid utf-8");
/// assert!(output.contains("complete -c git-claw"));
/// ```
/// Runs the shell completion workflow, writing completion script to stdout.
///
/// :param shell: Target shell for which to generate completions.
/// :return: Result indicating success or error.
///
/// # Example
///
/// ```
/// use clap_complete::Shell;
/// use git_claw::workflow::completion::run_completion_workflow;
///
/// let result = run_completion_workflow(Shell::Bash);
/// assert!(result.is_ok());
/// ```