Skip to content

Commit 13b9a24

Browse files
authored
Merge pull request #289 from EmmEff/fix-command-line-example
Fix command-line example
2 parents 6ef1266 + 5933700 commit 13b9a24

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

pkg/siftool/add.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2022, Sylabs Inc. All rights reserved.
1+
// Copyright (c) 2019-2023, Sylabs Inc. All rights reserved.
22
// Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
33
// Copyright (c) 2017, Yannick Cote <yhcote@gmail.com> All rights reserved.
44
// This software is licensed under a 3-clause BSD license. Please consult the
@@ -38,11 +38,11 @@ var (
3838
func getAddExamples(rootPath string) string {
3939
examples := []string{
4040
rootPath +
41-
" add image.sif recipe.def -datatype 1",
41+
" add image.sif recipe.def --datatype 1",
4242
rootPath +
43-
" add image.sif rootfs.squashfs --datatype 4 --parttype 1 --partfs 1 ----partarch 2",
43+
" add image.sif rootfs.squashfs --datatype 4 --parttype 1 --partfs 1 --partarch 2",
4444
rootPath +
45-
" add image.sif signature.bin -datatype 5 --signentity 433FE984155206BD962725E20E8713472A879943 --signhash 1",
45+
" add image.sif signature.bin --datatype 5 --signentity 433FE984155206BD962725E20E8713472A879943 --signhash 1",
4646
}
4747
return strings.Join(examples, "\n")
4848
}
@@ -54,34 +54,34 @@ func addFlags(fs *pflag.FlagSet) {
5454
1-Deffile, 2-EnvVar, 3-Labels,
5555
4-Partition, 5-Signature, 6-GenericJSON,
5656
7-Generic, 8-CryptoMessage, 9-SBOM`)
57-
partType = fs.Int32("parttype", 0, `the type of partition (with -datatype 4-Partition)
57+
partType = fs.Int32("parttype", 0, `the type of partition (with --datatype 4-Partition)
5858
[NEEDED, no default]:
5959
1-System, 2-PrimSys, 3-Data,
6060
4-Overlay`)
61-
partFS = fs.Int32("partfs", 0, `the filesystem used (with -datatype 4-Partition)
61+
partFS = fs.Int32("partfs", 0, `the filesystem used (with --datatype 4-Partition)
6262
[NEEDED, no default]:
6363
1-Squash, 2-Ext3, 3-ImmuObj,
6464
4-Raw`)
65-
partArch = fs.Int32("partarch", 0, `the main architecture used (with -datatype 4-Partition)
65+
partArch = fs.Int32("partarch", 0, `the main architecture used (with --datatype 4-Partition)
6666
[NEEDED, no default]:
6767
1-386, 2-amd64, 3-arm,
6868
4-arm64, 5-ppc64, 6-ppc64le,
6969
7-mips, 8-mipsle, 9-mips64,
7070
10-mips64le, 11-s390x, 12-riscv64`)
71-
signHash = fs.Int32("signhash", 0, `the signature hash used (with -datatype 5-Signature)
71+
signHash = fs.Int32("signhash", 0, `the signature hash used (with --datatype 5-Signature)
7272
[NEEDED, no default]:
7373
1-SHA256, 2-SHA384, 3-SHA512,
7474
4-BLAKE2s_256, 5-BLAKE2b_256`)
75-
signEntity = fs.String("signentity", "", `the entity that signs (with -datatype 5-Signature)
75+
signEntity = fs.String("signentity", "", `the entity that signs (with --datatype 5-Signature)
7676
[NEEDED, no default]:
7777
example: 433FE984155206BD962725E20E8713472A879943`)
78-
sbomFormat = fs.String("sbomformat", "", `the SBOM format (with -datatype 9-sbom):
78+
sbomFormat = fs.String("sbomformat", "", `the SBOM format (with --datatype 9-sbom):
7979
cyclonedx-json, cyclonedx-xml, github-json,
8080
spdx-json, spdx-rdf, spdx-tag-value,
8181
spdx-yaml, syft-json`)
8282
groupID = fs.Uint32("groupid", 0, "set groupid [default: 0]")
8383
linkID = fs.Uint32("link", 0, "set link pointer [default: 0]")
84-
alignment = fs.Int("alignment", 0, "set alignment [default: 4096 with -datatype 4-Partition, 0 otherwise]")
84+
alignment = fs.Int("alignment", 0, "set alignment [default: 4096 with --datatype 4-Partition, 0 otherwise]")
8585
name = fs.String("filename", "", "set logical filename/handle [default: input filename]")
8686
}
8787

@@ -189,9 +189,9 @@ func getSBOMFormat() (sif.SBOMFormat, error) {
189189
}
190190

191191
var (
192-
errPartitionArgs = errors.New("with partition datatype, -partfs, -parttype and -partarch must be passed")
192+
errPartitionArgs = errors.New("with partition datatype, --partfs, --parttype and --partarch must be passed")
193193
errInvalidFingerprintLength = errors.New("invalid signing entity fingerprint length")
194-
errSBOMArgs = errors.New("with SBOM datatype, -sbomformat must be passed")
194+
errSBOMArgs = errors.New("with SBOM datatype, --sbomformat must be passed")
195195
)
196196

197197
func getOptions(dt sif.DataType, fs *pflag.FlagSet) ([]sif.DescriptorInputOpt, error) {

pkg/siftool/testdata/TestAddCommands/Add/out.golden

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Usage:
44
siftool add <sif_path> <object_path> [flags]
55

66
Examples:
7-
siftool add image.sif recipe.def -datatype 1
8-
siftool add image.sif rootfs.squashfs --datatype 4 --parttype 1 --partfs 1 ----partarch 2
9-
siftool add image.sif signature.bin -datatype 5 --signentity 433FE984155206BD962725E20E8713472A879943 --signhash 1
7+
siftool add image.sif recipe.def --datatype 1
8+
siftool add image.sif rootfs.squashfs --datatype 4 --parttype 1 --partfs 1 --partarch 2
9+
siftool add image.sif signature.bin --datatype 5 --signentity 433FE984155206BD962725E20E8713472A879943 --signhash 1
1010

1111
Flags:
12-
--alignment int set alignment [default: 4096 with -datatype 4-Partition, 0 otherwise]
12+
--alignment int set alignment [default: 4096 with --datatype 4-Partition, 0 otherwise]
1313
--datatype int the type of data to add
1414
[NEEDED, no default]:
1515
1-Deffile, 2-EnvVar, 3-Labels,
@@ -19,28 +19,28 @@ Flags:
1919
--groupid uint32 set groupid [default: 0]
2020
-h, --help help for add
2121
--link uint32 set link pointer [default: 0]
22-
--partarch int32 the main architecture used (with -datatype 4-Partition)
22+
--partarch int32 the main architecture used (with --datatype 4-Partition)
2323
[NEEDED, no default]:
2424
1-386, 2-amd64, 3-arm,
2525
4-arm64, 5-ppc64, 6-ppc64le,
2626
7-mips, 8-mipsle, 9-mips64,
2727
10-mips64le, 11-s390x, 12-riscv64
28-
--partfs int32 the filesystem used (with -datatype 4-Partition)
28+
--partfs int32 the filesystem used (with --datatype 4-Partition)
2929
[NEEDED, no default]:
3030
1-Squash, 2-Ext3, 3-ImmuObj,
3131
4-Raw
32-
--parttype int32 the type of partition (with -datatype 4-Partition)
32+
--parttype int32 the type of partition (with --datatype 4-Partition)
3333
[NEEDED, no default]:
3434
1-System, 2-PrimSys, 3-Data,
3535
4-Overlay
36-
--sbomformat string the SBOM format (with -datatype 9-sbom):
36+
--sbomformat string the SBOM format (with --datatype 9-sbom):
3737
cyclonedx-json, cyclonedx-xml, github-json,
3838
spdx-json, spdx-rdf, spdx-tag-value,
3939
spdx-yaml, syft-json
40-
--signentity string the entity that signs (with -datatype 5-Signature)
40+
--signentity string the entity that signs (with --datatype 5-Signature)
4141
[NEEDED, no default]:
4242
example: 433FE984155206BD962725E20E8713472A879943
43-
--signhash int32 the signature hash used (with -datatype 5-Signature)
43+
--signhash int32 the signature hash used (with --datatype 5-Signature)
4444
[NEEDED, no default]:
4545
1-SHA256, 2-SHA384, 3-SHA512,
4646
4-BLAKE2s_256, 5-BLAKE2b_256

0 commit comments

Comments
 (0)