Skip to content

Commit

Permalink
Symbol @ is now searched from end of string to use with email addresses
Browse files Browse the repository at this point in the history
Some runtime errors escaped with return statement

cmd folder removed from repo (use make build)

Todo list added
  • Loading branch information
readyyyk committed Jun 6, 2023
1 parent 5ef6cc3 commit 4b792ea
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
br.sh
.idea/
cmd/.tokens
.ssh
cmd/
.ssh
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ SHELL:=/bin/bash
name=tokens

build:
@GOOS=darwin GOARCH=amd64 go build -o cmd/${name}-darwin-amd64
@GOOS=darwin GOARCH=arm64 go build -o cmd/${name}-darwin-arm64
@GOOS=linux GOARCH=arm64 go build -o cmd/${name}-linux-arm64
@GOOS=linux GOARCH=amd64 go build -o cmd/${name}-linux-amd64
@GOOS=linux GOARCH=386 go build -o cmd/${name}-linux-386
@GOOS=windows GOARCH=amd64 go build -o cmd/${name}-windows-amd64.exe
GOOS=darwin GOARCH=amd64 go build -o cmd/${name}-darwin-amd64
GOOS=darwin GOARCH=arm64 go build -o cmd/${name}-darwin-arm64
GOOS=linux GOARCH=arm64 go build -o cmd/${name}-linux-arm64
GOOS=linux GOARCH=amd64 go build -o cmd/${name}-linux-amd64
GOOS=linux GOARCH=386 go build -o cmd/${name}-linux-386
GOOS=windows GOARCH=amd64 go build -o cmd/${name}-windows-amd64.exe

default:
@go build -o cmd/tokens
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,6 @@ sudo make install
> `Not found record with user: raeadyyyk for host: github.com`
# TODO
- Encrypt data file
- refactor everything...
- add password input
- encryption for data file
Binary file removed cmd/tokens
Binary file not shown.
Binary file removed cmd/tokens-darwin-amd64
Binary file not shown.
Binary file removed cmd/tokens-darwin-arm64
Binary file not shown.
Binary file removed cmd/tokens-linux-386
Binary file not shown.
Binary file removed cmd/tokens-linux-amd64
Binary file not shown.
Binary file removed cmd/tokens-linux-arm64
Binary file not shown.
Binary file removed cmd/tokens-windows-amd64
Binary file not shown.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
module local
module github.com/readyyyk/little-pswd-mgr

go 1.20

require (
github.com/jedib0t/go-pretty/v6 v6.4.6 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rodaine/table v1.1.0 // indirect
golang.org/x/sys v0.7.0 // indirect
)
13 changes: 11 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import (
"strings"
)

/*
TODO:
- refactor everything...
- add password input
- encryption for data file
*/

func logError(err error) {
if err != nil {
panic(err)
Expand Down Expand Up @@ -140,10 +147,11 @@ func main() {
}

spaceIndex := strings.Index(os.Args[2], " ")
atIndex := strings.Index(os.Args[2], "@")
atIndex := strings.LastIndex(os.Args[2], "@")

if spaceIndex == -1 || atIndex == -1 {
fmt.Println(text.FgRed.Sprint("Provide data in valid format '<data> <user>@<host>'"))
return
}

tokensData.add(record{
Expand All @@ -157,9 +165,10 @@ func main() {
if os.Args[1] == "--del" || os.Args[1] == "-d" {
if len(os.Args) < 3 {
fmt.Println(text.FgRed.Sprint("Provide data in format <user>@<host>"))
return
}

atIndex := strings.Index(os.Args[2], "@")
atIndex := strings.LastIndex(os.Args[2], "@")
if atIndex == -1 {
fmt.Println(text.FgRed.Sprint("Provide data in valid format <user>@<host>"))
return
Expand Down

0 comments on commit 4b792ea

Please sign in to comment.