printable_shell_command/
formatting_options.rs

1#[derive(Clone, Copy, Debug, Eq, PartialEq)]
2pub enum Quoting {
3    /// Quote only arguments that need it for safety. This tries to be
4    /// portable and safe across shells, but true safety and portability is hard
5    /// to guarantee.
6    Auto,
7
8    /// Quote all arguments, even ones that don't need it. This is
9    /// more likely to be safe under all circumstances.
10    ExtraSafe,
11}
12
13impl Default for Quoting {
14    fn default() -> Self {
15        Self::Auto
16    }
17}
18
19#[derive(Clone, Copy, Debug, Eq, PartialEq)]
20pub enum ArgumentLineWrapping {
21    ByEntry,
22    NestedByEntry,
23    ByArgument,
24    Inline,
25}
26
27impl Default for ArgumentLineWrapping {
28    fn default() -> Self {
29        Self::ByEntry
30    }
31}
32
33#[derive(Default)]
34pub struct FormattingOptions {
35    pub main_indentation: Option<String>,
36    pub arg_indentation: Option<String>,
37    pub quoting: Option<Quoting>,
38    // Line wrapping to use between arguments.
39    pub argument_line_wrapping: Option<ArgumentLineWrapping>,
40    pub skip_line_wrap_before_first_arg: Option<bool>,
41    // TODO: text styling
42}