Skip to content

Commit

Permalink
style: 💬 show sub command hints in menu
Browse files Browse the repository at this point in the history
  • Loading branch information
abhimanyu003 committed Apr 6, 2023
1 parent da2aefb commit 9aa2088
Show file tree
Hide file tree
Showing 38 changed files with 225 additions and 155 deletions.
7 changes: 5 additions & 2 deletions processors/ascii85.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package processors
import (
"bytes"
"encoding/ascii85"
"fmt"
"io"
)

Expand Down Expand Up @@ -36,7 +37,8 @@ func (p ASCII85Encoding) Flags() []Flag {
}

func (p ASCII85Encoding) Title() string {
return "Ascii85 / Base85 Encoding"
title := "Ascii85 / Base85 Encoding"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p ASCII85Encoding) Description() string {
Expand Down Expand Up @@ -73,7 +75,8 @@ func (p ASCII85Decoding) Flags() []Flag {
}

func (p ASCII85Decoding) Title() string {
return "Ascii85 / Base85 Decoding"
title := "Ascii85 / Base85 Decoding"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p ASCII85Decoding) Description() string {
Expand Down
8 changes: 4 additions & 4 deletions processors/ascii85_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ func TestAscii85Encoding_Command(t *testing.T) {
}{
alias: []string{"ascii85-encoding", "base85-encode", "b85-encode"},
description: "Encode your text to Ascii85 ( Base85 )",
filterValue: "Ascii85 / Base85 Encoding",
filterValue: "Ascii85 / Base85 Encoding (ascii85-encode)",
flags: nil,
name: "ascii85-encode",
title: "Ascii85 / Base85 Encoding",
title: "Ascii85 / Base85 Encoding (ascii85-encode)",
}
p := ASCII85Encoding{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down Expand Up @@ -93,10 +93,10 @@ func TestAscii85Decoding_Command(t *testing.T) {
}{
alias: []string{"ascii85-decoding", "base85-decode", "b85-decode"},
description: "Decode your text to Ascii85 ( Base85 ) text",
filterValue: "Ascii85 / Base85 Decoding",
filterValue: "Ascii85 / Base85 Decoding (ascii85-decode)",
flags: nil,
name: "ascii85-decode",
title: "Ascii85 / Base85 Decoding",
title: "Ascii85 / Base85 Decoding (ascii85-decode)",
}
p := ASCII85Decoding{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down
7 changes: 5 additions & 2 deletions processors/base32.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package processors

import (
"encoding/base32"
"fmt"
)

// Base32Encoding encode string to base64.
Expand All @@ -24,7 +25,8 @@ func (p Base32Encoding) Flags() []Flag {
}

func (p Base32Encoding) Title() string {
return "Base32 Encoding"
title := "Base32 Encoding"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p Base32Encoding) Description() string {
Expand Down Expand Up @@ -56,7 +58,8 @@ func (p Base32Decode) Flags() []Flag {
}

func (p Base32Decode) Title() string {
return "Base32 Decode"
title := "Base32 Decode"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p Base32Decode) Description() string {
Expand Down
8 changes: 4 additions & 4 deletions processors/base32_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ func TestBase32Encode_Command(t *testing.T) {
}{
alias: []string{"b32-enc", "b32-encode"},
description: "Encode your text to Base32",
filterValue: "Base32 Encoding",
filterValue: "Base32 Encoding (base32-encode)",
flags: nil,
name: "base32-encode",
title: "Base32 Encoding",
title: "Base32 Encoding (base32-encode)",
}
p := Base32Encoding{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down Expand Up @@ -93,10 +93,10 @@ func TestBase32Decode_Command(t *testing.T) {
}{
alias: []string{"b32-dec", "b32-decode"},
description: "Decode your base32 text",
filterValue: "Base32 Decode",
filterValue: "Base32 Decode (base32-decode)",
flags: nil,
name: "base32-decode",
title: "Base32 Decode",
title: "Base32 Decode (base32-decode)",
}
p := Base32Decode{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down
7 changes: 5 additions & 2 deletions processors/base64.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package processors

import (
"encoding/base64"
"fmt"
)

var base64RawFlag = Flag{
Expand Down Expand Up @@ -48,7 +49,8 @@ func (p Base64Encode) Flags() []Flag {
}

func (p Base64Encode) Title() string {
return "Base64 Encoding"
title := "Base64 Encoding"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p Base64Encode) Description() string {
Expand Down Expand Up @@ -86,7 +88,8 @@ func (p Base64Decode) Flags() []Flag {
}

func (p Base64Decode) Title() string {
return "Base64 Decode"
title := "Base64 Decode"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p Base64Decode) Description() string {
Expand Down
8 changes: 4 additions & 4 deletions processors/base64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ func TestBase64Encode_Command(t *testing.T) {
}{
alias: []string{"b64-enc", "b64-encode"},
description: "Encode your text to Base64",
filterValue: "Base64 Encoding",
filterValue: "Base64 Encoding (base64-encode)",
flags: []Flag{base64RawFlag},
name: "base64-encode",
title: "Base64 Encoding",
title: "Base64 Encoding (base64-encode)",
}
p := Base64Encode{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down Expand Up @@ -114,10 +114,10 @@ func TestBase64Decode_Command(t *testing.T) {
}{
alias: []string{"b64-dec", "b64-decode"},
description: "Decode your base64 text",
filterValue: "Base64 Decode",
filterValue: "Base64 Decode (base64-decode)",
flags: []Flag{base64RawFlag},
name: "base64-decode",
title: "Base64 Decode",
title: "Base64 Decode (base64-decode)",
}
p := Base64Decode{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down
7 changes: 5 additions & 2 deletions processors/base64url.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package processors

import (
"encoding/base64"
"fmt"
)

// Base64URLEncode encode string to base64.
Expand All @@ -27,7 +28,8 @@ func (p Base64URLEncode) Flags() []Flag {
}

func (p Base64URLEncode) Title() string {
return "Base64URL Encoding"
title := "Base64URL Encoding"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p Base64URLEncode) Description() string {
Expand Down Expand Up @@ -65,7 +67,8 @@ func (p Base64URLDecode) Flags() []Flag {
}

func (p Base64URLDecode) Title() string {
return "Base64URL Decode"
title := "Base64URL Decode"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p Base64URLDecode) Description() string {
Expand Down
8 changes: 4 additions & 4 deletions processors/base64url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ func TestBase64URLEncode_Command(t *testing.T) {
}{
alias: []string{"b64url-enc", "b64url-encode"},
description: "Encode your text to Base64 with URL Safe",
filterValue: "Base64URL Encoding",
filterValue: "Base64URL Encoding (base64url-encode)",
flags: []Flag{base64RawFlag},
name: "base64url-encode",
title: "Base64URL Encoding",
title: "Base64URL Encoding (base64url-encode)",
}
p := Base64URLEncode{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down Expand Up @@ -114,10 +114,10 @@ func TestBase64URLDecode_Command(t *testing.T) {
}{
alias: []string{"b64url-dec", "b64url-decode"},
description: "Decode your base64 text with URL Safe",
filterValue: "Base64URL Decode",
filterValue: "Base64URL Decode (base64url-decode)",
flags: []Flag{base64RawFlag},
name: "base64url-decode",
title: "Base64URL Decode",
title: "Base64URL Decode (base64url-decode)",
}
p := Base64URLDecode{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down
21 changes: 14 additions & 7 deletions processors/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func (p MD5) Flags() []Flag {
}

func (p MD5) Title() string {
return "MD5 Sum"
title := "MD5 Sum"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p MD5) Description() string {
Expand Down Expand Up @@ -69,7 +70,8 @@ func (p SHA1) Flags() []Flag {
}

func (p SHA1) Title() string {
return "SHA1 Sum"
title := "SHA1 Sum"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p SHA1) Description() string {
Expand Down Expand Up @@ -104,7 +106,8 @@ func (p SHA256) Flags() []Flag {
}

func (p SHA256) Title() string {
return "SHA256 Sum"
title := "SHA256 Sum"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p SHA256) Description() string {
Expand Down Expand Up @@ -139,7 +142,8 @@ func (p SHA512) Flags() []Flag {
}

func (p SHA512) Title() string {
return "SHA512 Sum"
title := "SHA512 Sum"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p SHA512) Description() string {
Expand Down Expand Up @@ -172,7 +176,8 @@ func (p SHA224) Flags() []Flag {
}

func (p SHA224) Title() string {
return "SHA224 Sum"
title := "SHA224 Sum"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p SHA224) Description() string {
Expand Down Expand Up @@ -205,7 +210,8 @@ func (p SHA384) Flags() []Flag {
}

func (p SHA384) Title() string {
return "SHA384 Sum"
title := "SHA384 Sum"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p SHA384) Description() string {
Expand Down Expand Up @@ -256,7 +262,8 @@ func (p Bcrypt) Flags() []Flag {
}

func (p Bcrypt) Title() string {
return "Bcrypt Hash"
title := "Bcrypt Hash"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p Bcrypt) Description() string {
Expand Down
28 changes: 14 additions & 14 deletions processors/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ func TestMD5Encode_Command(t *testing.T) {
}{
alias: []string{"md5-sum"},
description: "Get the MD5 checksum of your text",
filterValue: "MD5 Sum",
filterValue: "MD5 Sum (md5)",
flags: nil,
name: "md5",
title: "MD5 Sum",
title: "MD5 Sum (md5)",
}
p := MD5{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down Expand Up @@ -123,10 +123,10 @@ func TestSHA1Encode_Command(t *testing.T) {
}{
alias: []string{"sha1-sum"},
description: "Get the SHA1 checksum of your text",
filterValue: "SHA1 Sum",
filterValue: "SHA1 Sum (sha1)",
flags: nil,
name: "sha1",
title: "SHA1 Sum",
title: "SHA1 Sum (sha1)",
}
p := SHA1{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down Expand Up @@ -204,10 +204,10 @@ func TestSHA256Encode_Command(t *testing.T) {
}{
alias: []string{"sha256-sum"},
description: "Get the SHA256 checksum of your text",
filterValue: "SHA256 Sum",
filterValue: "SHA256 Sum (sha256)",
flags: nil,
name: "sha256",
title: "SHA256 Sum",
title: "SHA256 Sum (sha256)",
}
p := SHA256{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down Expand Up @@ -285,10 +285,10 @@ func TestSHA224Encode_Command(t *testing.T) {
}{
alias: []string{"SHA224-sum"},
description: "Get the SHA224 checksum of your text",
filterValue: "SHA224 Sum",
filterValue: "SHA224 Sum (SHA224)",
flags: nil,
name: "SHA224",
title: "SHA224 Sum",
title: "SHA224 Sum (SHA224)",
}
p := SHA224{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down Expand Up @@ -366,10 +366,10 @@ func TestSHA384Encode_Command(t *testing.T) {
}{
alias: []string{"SHA384-sum"},
description: "Get the SHA384 checksum of your text",
filterValue: "SHA384 Sum",
filterValue: "SHA384 Sum (SHA384)",
flags: nil,
name: "SHA384",
title: "SHA384 Sum",
title: "SHA384 Sum (SHA384)",
}
p := SHA384{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down Expand Up @@ -447,10 +447,10 @@ func TestSHA512Encode_Command(t *testing.T) {
}{
alias: []string{"sha512-sum"},
description: "Get the SHA512 checksum of your text",
filterValue: "SHA512 Sum",
filterValue: "SHA512 Sum (sha512)",
flags: nil,
name: "sha512",
title: "SHA512 Sum",
title: "SHA512 Sum (sha512)",
}
p := SHA512{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down Expand Up @@ -528,7 +528,7 @@ func TestBcrypt_Command(t *testing.T) {
}{
alias: []string{"bcrypt-hash"},
description: "Get the Bcrypt hash of your text",
filterValue: "Bcrypt Hash",
filterValue: "Bcrypt Hash (bcrypt)",
flags: []Flag{
{
Name: "number-of-rounds",
Expand All @@ -539,7 +539,7 @@ func TestBcrypt_Command(t *testing.T) {
},
},
name: "bcrypt",
title: "Bcrypt Hash",
title: "Bcrypt Hash (bcrypt)",
}
p := Bcrypt{}
if got := p.Alias(); !reflect.DeepEqual(got, test.alias) {
Expand Down
4 changes: 3 additions & 1 deletion processors/emails.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package processors

import (
"fmt"
"github.com/mcnijman/go-emailaddress"
"strings"
)
Expand Down Expand Up @@ -48,7 +49,8 @@ func (p ExtractEmails) Flags() []Flag {
}

func (p ExtractEmails) Title() string {
return "Extract Emails"
title := "Extract Emails"
return fmt.Sprintf("%s (%s)", title, p.Name())
}

func (p ExtractEmails) Description() string {
Expand Down

0 comments on commit 9aa2088

Please sign in to comment.