Skip to content

Commit

Permalink
Update --detached-sign to --detach-sign, remove "auto generated" line…
Browse files Browse the repository at this point in the history
… from docs (#242)

* Disable, remove 'Auto generated' line for CLI docs

Signed-off-by: Aditya Sirish <[email protected]>

* Update --detached-sign flag to --detach-sign

Gitsign currently does not match other signing tools such as GPG in its
flag to create detached signatures. This commit deprecates the old flag
and introduces a correctly named alternative. This has likely not been
discovered because Git passes in `-b` rather than the full flag. This
shorthand has been moved to the new flag definition.

Signed-off-by: Aditya Sirish <[email protected]>

---------

Signed-off-by: Aditya Sirish <[email protected]>
  • Loading branch information
adityasaky authored Feb 21, 2023
1 parent 030a85a commit 0a4c62a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions docs/cli/gitsign.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gitsign [flags]

```
-a, --armor create ascii armored output
-b, --detached-sign make a detached signature
-b, --detach-sign make a detached signature
-h, --help help for gitsign
--include-certs int -3 is the same as -2, but omits issuer when cert has Authority Information Access extension. -2 includes all certs except root. -1 includes all certs. 0 includes no certs. 1 includes leaf cert. >1 includes n from the leaf. Default -2. (default -2)
-u, --local-user string use USER-ID to sign
Expand All @@ -26,4 +26,3 @@ gitsign [flags]
* [gitsign show](gitsign_show.md) - Show source predicate information
* [gitsign version](gitsign_version.md) - print Gitsign version

###### Auto generated by spf13/cobra on 26-Nov-2022
1 change: 0 additions & 1 deletion docs/cli/gitsign_attest.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ gitsign attest [flags]

* [gitsign](gitsign.md) - Keyless Git signing with Sigstore!

###### Auto generated by spf13/cobra on 26-Nov-2022
1 change: 0 additions & 1 deletion docs/cli/gitsign_show.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ gitsign show [revision] [flags]

* [gitsign](gitsign.md) - Keyless Git signing with Sigstore!

###### Auto generated by spf13/cobra on 26-Nov-2022
1 change: 0 additions & 1 deletion docs/cli/gitsign_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ gitsign version [flags]

* [gitsign](gitsign.md) - Keyless Git signing with Sigstore!

###### Auto generated by spf13/cobra on 26-Nov-2022
12 changes: 8 additions & 4 deletions internal/commands/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,23 @@ func (o *options) AddFlags(cmd *cobra.Command) {
cmd.Flags().BoolVar(&o.FlagVersion, "version", false, "print Gitsign version")

cmd.Flags().StringVarP(&o.FlagLocalUser, "local-user", "u", "", "use USER-ID to sign")
cmd.Flags().BoolVarP(&o.FlagDetachedSignature, "detached-sign", "b", false, "make a detached signature")
cmd.Flags().BoolVarP(&o.FlagDetachedSignature, "detached-sign", "", false, "make a detached signature")
cmd.Flags().BoolVarP(&o.FlagDetachedSignature, "detach-sign", "b", false, "make a detached signature")
cmd.Flags().BoolVarP(&o.FlagArmor, "armor", "a", false, "create ascii armored output")
cmd.Flags().IntVar(&o.FlagStatusFD, "status-fd", -1, "write special status strings to the file descriptor n.")
cmd.Flags().IntVar(&o.FlagIncludeCerts, "include-certs", -2, "-3 is the same as -2, but omits issuer when cert has Authority Information Access extension. -2 includes all certs except root. -1 includes all certs. 0 includes no certs. 1 includes leaf cert. >1 includes n from the leaf. Default -2.")

cmd.Flags().MarkDeprecated("detached-sign", "--detached-sign has been deprecated in favor of --detach-sign to match the interface of other signing tools") //nolint:errcheck
}

func New(cfg *config.Config) *cobra.Command {
o := &options{Config: cfg}

rootCmd := &cobra.Command{
Use: "gitsign",
Short: "Keyless Git signing with Sigstore!",
Args: cobra.ArbitraryArgs,
Use: "gitsign",
Short: "Keyless Git signing with Sigstore!",
Args: cobra.ArbitraryArgs,
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, args []string) error {
s := io.New(o.Config.LogPath)
return s.Wrap(func() error {
Expand Down

0 comments on commit 0a4c62a

Please sign in to comment.