Skip to content

Commit 9d20985

Browse files
committed
Improve documentation
Signed-off-by: Bastien <bastien.wermeille@gmail.com>
1 parent 755c16d commit 9d20985

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

README.rst

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,15 +1130,15 @@ Below is an example of publishing to Vault (using token auth with a local dev in
11301130
Important information on types
11311131
------------------------------
11321132
1133-
YAML and JSON type extensions
1134-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1133+
YAML, JSON, ENV and INI type extensions
1134+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11351135
11361136
SOPS uses the file extension to decide which encryption method to use on the file
11371137
content. ``YAML``, ``JSON``, ``ENV``, and ``INI`` files are treated as trees of data, and key/values are
11381138
extracted from the files to only encrypt the leaf values. The tree structure is also
11391139
used to check the integrity of the file.
11401140
1141-
Therefore, if a file is encrypted using a specific format, it need to be decrypted
1141+
Therefore, if a file is encrypted using a specific format, it needs to be decrypted
11421142
in the same format. The easiest way to achieve this is to conserve the original file
11431143
extension after encrypting a file. For example:
11441144
@@ -1165,23 +1165,27 @@ When operating on stdin, use the ``--input-type`` and ``--output-type`` flags as
11651165
JSON indentation
11661166
~~~~~~~~~~~~~~~~
11671167
1168-
``sops`` indent ``SOPS`` files by default using one ``tab``. However, you can change
1169-
this default behaviour to use spaces by either using the additional ``--indent=2`` cli option or
1170-
by configuring ``.sops.yaml`` with the code below. (value ``0`` is no indentation)
1168+
SOPS indents ``JSON`` files by default using one ``tab``. However, you can change
1169+
this default behaviour to use ``spaces`` by either using the additional ``--indent=2`` CLI option or
1170+
by configuring ``.sops.yaml`` with the code below.
1171+
1172+
The special value ``0`` disables indentation, and ``-1`` uses a single tab.
11711173
11721174
.. code:: yaml
1175+
11731176
stores:
11741177
json:
11751178
indent: 2
11761179
11771180
YAML indentation
11781181
~~~~~~~~~~~~~~~~
11791182
1180-
``sops`` indent ``YAML`` files by default using 4 spaces. However, you can change
1181-
this default behaviour by either using the additional ``--indent=2`` cli option or
1182-
by configuring ``.sops.yaml`` with :
1183+
SOPS indents ``YAML`` files by default using 4 spaces. However, you can change
1184+
this default behaviour by either using the additional ``--indent=2`` CLI option or
1185+
by configuring ``.sops.yaml`` with:
11831186
11841187
.. code:: yaml
1188+
11851189
stores:
11861190
yaml:
11871191
indent: 2

cmd/sops/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ func main() {
706706
},
707707
cli.IntFlag{
708708
Name: "indent",
709-
Usage: "the number of space to indent YAML encoded file for encryption",
709+
Usage: "the number of spaces to indent YAML or JSON encoded file for encryption",
710710
},
711711
cli.BoolFlag{
712712
Name: "verbose",
@@ -1087,7 +1087,7 @@ func inputStore(context *cli.Context, path string) common.Store {
10871087

10881088
func outputStore(context *cli.Context, path string) common.Store {
10891089
storesConf, _ := loadStoresConfig(context, path)
1090-
if context.Int("indent") != 0 {
1090+
if context.IsSet("indent") {
10911091
indent := context.Int("indent")
10921092
storesConf.YAML.Indent = indent
10931093
storesConf.JSON.Indent = indent

0 commit comments

Comments
 (0)