Skip to content

Commit

Permalink
refactor(cmd): rename unused function parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Universal Studio <[email protected]>
  • Loading branch information
TMUniversal committed Feb 22, 2024
1 parent af23149 commit 21f8e4d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var decodeCmd = &cobra.Command{
Long: `This command allows you to decode binary data saved by PaperCrypt.
The data should be read from a file or stdin, you will be required to provide a passphrase.`,
Example: `papercrypt decode -i <file>.txt -o <file>.txt`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
// 1. Open output file
outFile, err := internal.GetFileHandleCarefully(outFileName, overrideOutFile)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Please note, to decrypt the data from the output PaperCrypt PDF, you'll need the
encryption process. Treat this passphrase with care; loss of the passphrase could result in the permanent loss of the
encrypted data.`,
Example: "papercrypt generate -i <file>.json -o <file>.pdf --purpose \"My secret data\" --comment \"This is a comment\" --date \"2021-01-01 12:00:00\"",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
// 1. Open output file
outFile, err := internal.GetFileHandleCarefully(outFileName, overrideOutFile)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/generateKey.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var generateKeyCmd = &cobra.Command{
Short: "Generates a mnemonic key phrase",
Long: fmt.Sprintf(`This command generates a mnemonic key phrase base on the eff.org large word list,
which can be found here: %s.`, wordListURLFormatted),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
outFile, err := internal.GetFileHandleCarefully(outFileName, overrideOutFile)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/man.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var manCmd = &cobra.Command{
SilenceUsage: true,
DisableFlagsInUseLine: true,
Hidden: true,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
manPage, err := mcobra.NewManPage(1, rootCmd.Root())
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/phraseSheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var phraseSheetCmd = &cobra.Command{
Use: "phraseSheet [base64 seed]",
Short: "Generate a passphrase sheet.",
Example: "papercrypt phraseSheet -o phraseSheet.pdf",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
// 1. Open output file
outFile, err := internal.GetFileHandleCarefully(outFileName, overrideOutFile)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/qr.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ This command allows you to decode data saved by PaperCrypt.
The QR code in a PaperCrypt document contains a JSON serialized object
that contains the encrypted data and the PaperCrypt metadata.`,
Example: `papercrypt qr ./qr.png | papercrypt decode -o ./out.json -P passphrase`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
// 1. get data from either argument or inFileName
if len(args) != 0 {
inFileName = args[0]
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ var rootCmd = &cobra.Command{
It is designed to let you enter data, encrypt it with a passphrase,
and then prepare a printable document that is optimized for being able to restore the data.`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
PersistentPreRun: func(_ *cobra.Command, _ []string) {
level := max(log.InfoLevel-log.Level(verbosity), log.DebugLevel)
log.SetLevel(level)
log.Debug("verbosity set to " + level.String())
},
PersistentPostRun: func(_ *cobra.Command, _ []string) {
log.Info("thank you for using papercrypt!")
},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
cmd.Println("PaperCrypt Copyright (C) 2023 TMUniversal <[email protected]>")
cmd.Println("This program comes with ABSOLUTELY NO WARRANTY; for details type `papercrypt show w'.")
cmd.Println("This is free software, and you are welcome to redistribute it")
Expand Down
6 changes: 3 additions & 3 deletions cmd/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var showCmdWarranty = &cobra.Command{
Aliases: []string{"w"},
SilenceUsage: true,
Short: "Show warranty info",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
log.Info("This program is licensed under the terms of the GNU AGPL-3.0-or-later license.")
log.Info("An excerpt from the license will be printed below, to view the full license, please run `papercrypt show c'.\n")
fmt.Println(` 15. Disclaimer of Warranty.
Expand Down Expand Up @@ -89,7 +89,7 @@ var showCmdCopyright = &cobra.Command{
Aliases: []string{"c", "license", "l"},
SilenceUsage: true,
Short: "Show copyright info",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
log.Info("This program is licensed under the terms of the GNU AGPL-3.0-or-later license.")
fmt.Println(*LicenseText)
},
Expand All @@ -100,7 +100,7 @@ var showCmdThirdParty = &cobra.Command{
Aliases: []string{"t"},
SilenceUsage: true,
Short: "Show third party licenses",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
fmt.Println(*ThirdPartyText)
},
}
Expand Down
5 changes: 3 additions & 2 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ var versionCmd = &cobra.Command{
Args: cobra.NoArgs,
Use: "version",
Short: "Shows the version and build information of the application",
PersistentPostRun: func(cmd *cobra.Command, args []string) {
PersistentPostRun: func(_ *cobra.Command, _ []string) {
// Present to override the default behavior of the root command
},
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
fmt.Println(internal.VersionInfo.String())
},
}
Expand Down

0 comments on commit 21f8e4d

Please sign in to comment.