Skip to content

Commit dafb043

Browse files
committed
Improve documentation
Signed-off-by: Bastien <bastien.wermeille@gmail.com>
1 parent c79db7c commit dafb043

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
@@ -702,7 +702,7 @@ func main() {
702702
},
703703
cli.IntFlag{
704704
Name: "indent",
705-
Usage: "the number of space to indent YAML encoded file for encryption",
705+
Usage: "the number of spaces to indent YAML or JSON encoded file for encryption",
706706
},
707707
cli.BoolFlag{
708708
Name: "verbose",
@@ -1077,7 +1077,7 @@ func inputStore(context *cli.Context, path string) common.Store {
10771077

10781078
func outputStore(context *cli.Context, path string) common.Store {
10791079
storesConf, _ := loadStoresConfig(context, path)
1080-
if context.Int("indent") != 0 {
1080+
if context.IsSet("indent") {
10811081
indent := context.Int("indent")
10821082
storesConf.YAML.Indent = indent
10831083
storesConf.JSON.Indent = indent

0 commit comments

Comments
 (0)