Package: yamkix
yamkixWhy?Because I like my yaml file to be nicely formattedBecausehttps://marketplace.visualstudio.com/items?itemName=adamvoss.yamlcreates (valid) yaml not compatible for kubernetes (and I mainly
edit yaml files for kubernetes)Becausehttps://marketplace.visualstudio.com/items?itemName=redhat.vscode-yamldoes not add explicit start of documents and I don't like it this
wayBecause I'm not a js/typescript dev so I don't want to go into a
VSCode extension with client and server languageWhat?>./yamkix-h
usage:yamkix[-h]-iINPUT[-tTYP][-oOUTPUT][-n][-e][-q][-f][-d]Formatyamlinputfile.Bydefault,explicit_startis`On`,explicit_endis`Off`andarrayelementsarepushedinwardsthestartofthematching
sequence.Commentsarepreservedthankstodefaultparsingmode`rt`.

optionalarguments:-h,--helpshowthishelpmessageandexit-iINPUT,--inputINPUTthefiletoparse-tTYP,--typTYPtheyamlparsermode.Canbe`safe`or`rt`-oOUTPUT,--outputOUTPUTthenameofthefiletogenerate(sameasinputfileifnotspecied)-n,--no-explicit-startbydefault,explicitstartoftheyamldocis`On`,youcandisableitwiththisoption-e,--explicit-endbydefault,explicitendoftheyamldocis`Off`,youcanenableitwiththisoption-q,--no-quotes-preservedbydefault,quotesarepreserverdyoucandisablethiswiththisoption-f,--default-flow-styleenablethedefaultflowstyle`Off`bydefault.Indefaultflowstyle(withtyp=`rt`),mapsandlistsarewrittenlikejson-d,--no-dash-inwardsbydefault,dasharepushedinwardsuse`--no-dash-inwards`tohavethedashstartatthesequencelevelConfigExplicit start of yaml docs by default (you can disable it with--no-explicit-start)Quotes preserved by default (you can disable it with--no-quotes-preserved)Arrays elements pushed inwards by default (you can disable it with--no-dash-inwards)Output file is input file by defaultComments preserved by default thanks toruamel.yamlround_tripmode (you can disable it with--typ safe)To preserve or not to preserve quotes?Quotes preservedmeans : if there were quotes in the input, they
will also be present in the output, and it will be the same type
(single/double) of quotesQuotes not preservedmeans :if quotes are not necessary (aroundpurestrings), they will
be removedif quotes are present around booleans and numbers, they will be
converted to default (single quotes)if quotes are not present around booleans and numbers, there
will be no quotes in the output tooNote: there is no option for the moment to force the usage of double
quotes when-q/--no-quotes-preservedis used.Quotes preserved (default behavior)With input :---apiVersion:extensions/v1beta1# with commentkind:ReplicaSetmetadata:name:tnamenamespace:tnsannotations:string_no_quotes:frontendstring_single_quotes:'frontend'string_double_quotes:"frontend"boolean_no_quotes:trueboolean_single_quotes:'true'boolean_double_quotes:"true"number_no_quotes:1number_single_quotes:'1'number_double_quotes:"1"the output will be the same as the input :---apiVersion:extensions/v1beta1# with commentkind:ReplicaSetmetadata:name:tnamenamespace:tnsannotations:string_no_quotes:frontendstring_single_quotes:'frontend'string_double_quotes:"frontend"boolean_no_quotes:trueboolean_single_quotes:'true'boolean_double_quotes:"true"number_no_quotes:1number_single_quotes:'1'number_double_quotes:"1"Quotes not preserved (using-q/--no-quotes-preserved)With input :---apiVersion:extensions/v1beta1# with commentkind:ReplicaSetmetadata:name:tnamenamespace:tnsannotations:string_no_quotes:frontendstring_single_quotes:'frontend'string_double_quotes:"frontend"boolean_no_quotes:trueboolean_single_quotes:'true'boolean_double_quotes:"true"number_no_quotes:1number_single_quotes:'1'number_double_quotes:"1"the output will be :---apiVersion:extensions/v1beta1# with commentkind:ReplicaSetmetadata:name:tnamenamespace:tnsannotations:string_no_quotes:frontendstring_single_quotes:frontendstring_double_quotes:frontendboolean_no_quotes:trueboolean_single_quotes:'true'boolean_double_quotes:'true'number_no_quotes:1number_single_quotes:'1'number_double_quotes:'1'Note:kubesplitis not fullyKubernetesaware for the moment, so it does not try to enforce
this behaviour only on string sensiblekubernetesresource fields
(.metadata.annotationsand.spec.containers.environmentvalues)Where does the name 'yamkix' come from?Thanks tohttp://online-generator.com/name-generator/product-name-generator.phpthat suggested mezamkix. Just switched the startingzfor theyofyamlUsageInstall the package withpip install --user yamkixSamplevscodetask :{"label":"format yaml with yamkix","type":"shell","command":"yamkix --input ${file}","group":"build","presentation":{"reveal":"always","panel":"shared"},"problemMatcher":[]}HackSee ourCONTRIBUTINGguide.