Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ipsax committed Nov 20, 2024
0 parents commit 72880e0
Show file tree
Hide file tree
Showing 12 changed files with 151 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kypher
20 changes: 20 additions & 0 deletions cmd/leet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"github.com/ipsax/kypher/internal"
"github.com/spf13/cobra"
)

func init() {
rootCmd.AddCommand(leetCmd)
}

var leetCmd = &cobra.Command{
Use: "leet",
Short: "use the 1337 cipher",
Long: `This is kypher's leet cipher`,
Run: func(cmd *cobra.Command, args []string) {
leet := internal.Leet{}
leet.Encode("todo, take cli args for encode or decode, maybe add autodetect for cipher type eventually?")
},
}
24 changes: 24 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cmd

import (
"fmt"
"os"

"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "kypher",
Short: "fun and misc. kyphers",
Long: `RTFM`,
Run: func(cmd *cobra.Command, args []string) {
// Do Stuff Here
},
}

func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
20 changes: 20 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
)

func init() {
rootCmd.AddCommand(versionCmd)
}

var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of kypher",
Long: `All software has versions this is kypher's version`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Amateur Kypher Cipher Punk Ciphers ~ v0.0.1")
},
}
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/ipsax/kypher

go 1.23.2

require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
30 changes: 30 additions & 0 deletions internal/chars.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package internal

type Chars struct {
a []string
b []string
c []string
d []string
e []string
f []string
g []string
h []string
i []string
j []string
k []string
l []string
m []string
n []string
o []string
p []string
q []string
r []string
s []string
t []string
u []string
v []string
w []string
x []string
y []string
z []string
}
25 changes: 25 additions & 0 deletions internal/leet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package internal

import (
"fmt"
"reflect"
)

type Leet struct{}

// todo make type for leetchars = https://en.wikipedia.org/wiki/Leet#Orthography
func leetIterator() {
fields := reflect.VisibleFields(reflect.TypeOf(Chars{}))
for _, field := range fields {
fmt.Printf("Key: %s\tType: %s\n", field.Name, field.Type)
}
}

func (Leet) Encode(str string) string {
leetIterator()
return "todo return str->leet cipher"
}

func (Leet) Decode(str string) string {
return "todo return leet->str msg"
}
1 change: 1 addition & 0 deletions internal/leet_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package internal
1 change: 1 addition & 0 deletions internal/rune.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package internal
1 change: 1 addition & 0 deletions internal/rune_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package internal
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import (
"github.com/ipsax/kypher/cmd"
)

func main() {
cmd.Execute()
}

0 comments on commit 72880e0

Please sign in to comment.