README.md 3,0 КБ
Newer Older
keewek's avatar
keewek включено в состав коммита
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# ansible-pretty-print

CLI tool that pretty-prints an output of `ansible-playbook --list-tasks` command.

[![](assets/docs/830_table_dos.png)](https://raw.githubusercontent.com/keewek/ansible-pretty-print/main/assets/docs/table_dos.png)

## Install

`go install github.com/keewek/ansible-pretty-print@latest`

or download app executable at [Releases](https://github.com/keewek/ansible-pretty-print/releases) page

## Usage

```
Usage: ansible-pretty-print [OPTION]... [FILE]
Pretty-print Ansible's --list-tasks output

  -chop
        chop long lines
  -dos
        DOS box-drawing characters
  -indent
        indent block/role
  -mono
        calculate string width as monospace width
  -stats
        print stats
  -stdin
        read standard input
  -table
        table output
  -version
        output version information
  -width int
        custom line width
```

- File
    
    `ansible-pretty-print path/to/ansible--list-tasks-output`

- Stdin

    `ansible-playbook --list-tasks path/to/playbook -i path/to/inventory | ansible-pretty-print --stdin`

 - BASH function

    ```bash
    lt-ansible-playbook() {
        ansible-playbook --list-tasks "$@" | ansible-pretty-print --stdin --chop
    }

    ltt-ansible-playbook() {
        ansible-playbook --list-tasks "$@" | ansible-pretty-print --stdin --dos --table
    }
    ```

    **Columns output:**

    `lt-ansible-playbook --list-tasks path/to/playbook -i path/to/inventory`
    
    **Table output:**

    `ltt-ansible-playbook --list-tasks path/to/playbook -i path/to/inventory`

## Features

- Default output

    [![](assets/docs/830_columns.png)](https://raw.githubusercontent.com/keewek/ansible-pretty-print/main/assets/docs/columns.png)

- Flag `--indent`: indent block/role

    [![](assets/docs/830_columns_indent.png)](https://raw.githubusercontent.com/keewek/ansible-pretty-print/main/assets/docs/columns_indent.png)

- Flag `--chop`: chop long lines

    [![](assets/docs/830_columns_chop_120.png)](https://raw.githubusercontent.com/keewek/ansible-pretty-print/main/assets/docs/columns_chop_120.png)

    > Use `--width` flag to specify custom width

- Flag `--table`: table output

    [![](assets/docs/830_table.png)](https://raw.githubusercontent.com/keewek/ansible-pretty-print/main/assets/docs/table.png)

    > Use `--width` flag to specify custom width

    [![](assets/docs/830_table_80.png)](https://raw.githubusercontent.com/keewek/ansible-pretty-print/main/assets/docs/table_80.png)

- Flag `--dos`: DOS box-drawing characters

    [![](assets/docs/830_table_dos.png)](https://raw.githubusercontent.com/keewek/ansible-pretty-print/main/assets/docs/table_dos.png)

- Flag `--mono`: calculate string width as monospace width

    Use with East-Asian content

    [![](assets/docs/830__table_EA.png)](https://raw.githubusercontent.com/keewek/ansible-pretty-print/main/assets/docs/table_EA.png)
    [![](assets/docs/830__table_EA_mono.png)](https://raw.githubusercontent.com/keewek/ansible-pretty-print/main/assets/docs/table_EA_mono.png)