yamltidy(3)
π yamltidy(3) β Reformat YAML files, but make it cute π
okay so this is a User Contributed Perl Documentation page for yamltidy(3), and it's literally about making your YAML files tidy. bestie, let's go. π«Ά
β¨ NAME β¨
yamltidy β Reformat YAML files.
πΈ ABSTRACT πΈ
Empty in the original β like, no abstract text here at all. Zero. Nada. π
π DESCRIPTION π
So this script checks YAML files according to a configuration and automatically reformats them. It'll output the formatted code on standard output, or edit the file directly. That's the whole assignment. π
π EXAMPLES π
Tidy a file and print to stdout
% cat in.yaml
---
a:
b:
c: d
% yamltidy in.yaml
---
a:
b:
c: d
Tidy content from stdin
% echo '---
a:
b:
c: d' | yamltidy -
---
a:
b:
c: d
Tidy a file and save the result back
% yamltidy --inplace in.yaml
% cat in.yaml
---
a:
b:
c: d
Process a list of files from stdin
# Tidy all .yaml files that are in git
% git ls-files | grep '.yaml$' | yamltidy --inplace --batch -
# short options
% git ls-files | grep '.yaml$' | yamltidy -i -b -
# Only tidy modified files
% git ls-files --modified | grep '.yaml$' | yamltidy --inplace --batch -
In the future yamltidy can take a directory as an argument and process file name patterns from configuration.
Use a certain configuration file
% yamltidy -c /path/to/yamltidy.yaml file.yaml
Partial formatting
From within an editor you can pass only a part of the file on stdin. This is important for keeping the indentation of that part. Also it won't add a --- header. Compare:
% echo '
a:
b: c' | yamltidy -
---
a:
b: c
% echo '
a:
b: c' | yamltidy --partial -
a:
b: c
Vim example configuration
# :noremap <leader>yt :%!yamltidy -<CR>
# :vnoremap <leader>yt :!yamltidy --partial -<CR>
π₯ GLOBAL OPTIONS π₯
--config-file,-cβ config file π--config-data,-dβ configuration as a string β¨--inplace,-iβ edit file inplace (flag) π--debugβ debugging output (flag) π--partialβ input is only a part of a YAML file (flag) π§©--indentβ override indentation spaces from config π--batch,-bβ tidy all files; currently requires parameter"-"for filenames passed via STDIN (flag) ποΈ--verboseβ output information (flag) π£--help,-hβ print usage message and exit (flag) π--versionβ print version information (flag) π·οΈ
π¦ SUBCOMMANDS π¦
Okay so this section is empty in the original β no subcommands listed. π
π cute sign-off: this page is from perl v5.42.0, dated 2024-02-02, and it's the yamltidy(3) manual. bye bestie, go tidy some YAML! β¨π
π¦ where this page comes from
- opensuse-leap 16.0: perl-YAML-Tidy 0.10.0-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms