Skip to content

Commit

Permalink
Release 0.2.0 (#2)
Browse files Browse the repository at this point in the history
* enpass move to separate module
* gopassstore in separate module
  • Loading branch information
revengel authored Jul 29, 2023
1 parent 4fccfc1 commit ce74dde
Show file tree
Hide file tree
Showing 16 changed files with 391 additions and 263 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: goreleaser/[email protected]
with:
version: latest
args: release --clean
args: release --clean --skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GOPATH: /home/runner/go
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/enpass2gopass
/.vscode
app
6 changes: 4 additions & 2 deletions attachment.go → enpass/attachment.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package main
package enpass

import (
"encoding/base64"
"net/http"
"strings"

"github.com/revengel/enpass2gopass/utils"
)

// Attachment -
Expand Down Expand Up @@ -83,7 +85,7 @@ func (a Attachment) GetName() string {

// GetLabelName -
func (a Attachment) GetLabelName() string {
return transliterate(a.Name)
return utils.Transliterate(a.Name)
}

// GetNameOriginal -
Expand Down
10 changes: 6 additions & 4 deletions data.go → enpass/data.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package main
package enpass

import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"

"github.com/revengel/enpass2gopass/utils"
)

// Data -
Expand All @@ -23,13 +25,13 @@ type FolderItem struct {
func (d Data) GetFoldersMap() FoldersMap {
out := make(map[string]string)
for _, folder := range d.Folders {
out[folder.UUID] = transliterate(folder.Title)
out[folder.UUID] = utils.Transliterate(folder.Title)
}
return out
}

// loadind data from json file
func loadData(dataPath string) (d Data, err error) {
// LoadData - loadind data from json file
func LoadData(dataPath string) (d Data, err error) {
absPath, err := filepath.Abs(dataPath)
if err != nil {
return
Expand Down
6 changes: 4 additions & 2 deletions field.go → enpass/field.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package main
package enpass

import "github.com/revengel/enpass2gopass/utils"

// Field -
type Field struct {
Expand Down Expand Up @@ -41,7 +43,7 @@ func (f Field) CheckTypes(in []string) bool {

// GetLabel -
func (f Field) GetLabel() string {
return transliterate(f.Label)
return utils.Transliterate(f.Label)
}

// GetValue -
Expand Down
6 changes: 3 additions & 3 deletions folder.go → enpass/folder.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package enpass

// FoldersMap -
type FoldersMap map[string]string
Expand All @@ -14,8 +14,8 @@ func (f FoldersMap) GetFolder(id string) string {
// GetFolders -
func (f FoldersMap) GetFolders(ids []string) (out []string) {
for _, id := range ids {
if f := f.GetFolder(id); id != "" {
out = append(out, f)
if fv := f.GetFolder(id); id != "" && fv != "" {
out = append(out, fv)
}
}
return out
Expand Down
18 changes: 10 additions & 8 deletions item.go → enpass/item.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package main
package enpass

import (
"fmt"
"strings"

"github.com/revengel/enpass2gopass/utils"
)

// DataItem -
Expand Down Expand Up @@ -44,7 +46,7 @@ func (i DataItem) GetCategory() string {

// GetCategoryPath -
func (i DataItem) GetCategoryPath() string {
return transliterate(i.Category)
return utils.Transliterate(i.Category)
}

// GetTitle -
Expand All @@ -54,7 +56,7 @@ func (i DataItem) GetTitle() string {

// GetTitlePath -
func (i DataItem) GetTitlePath() string {
return transliterate(i.Title)
return utils.Transliterate(i.Title)
}

// GetSubtitle -
Expand All @@ -68,19 +70,19 @@ func (i DataItem) GetNote() string {
}

// GetFolders -
func (i DataItem) GetFolders() []string {
func (i DataItem) GetFolders(foldersMap FoldersMap) []string {
return foldersMap.GetFolders(i.Folders)
}

// GetFirstFolder -
func (i DataItem) GetFirstFolder() string {
if fs := i.GetFolders(); len(fs) > 0 {
func (i DataItem) GetFirstFolder(foldersMap FoldersMap) string {
if fs := i.GetFolders(foldersMap); len(fs) > 0 {
return fs[0]
}
return ""
}

// GetFoldersStr -
func (i DataItem) GetFoldersStr() string {
return fmt.Sprintf("[%s]", strings.Join(i.GetFolders(), ", "))
func (i DataItem) GetFoldersStr(foldersMap FoldersMap) string {
return fmt.Sprintf("[%s]", strings.Join(i.GetFolders(foldersMap), ", "))
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module enpass2gopass
module github.com/revengel/enpass2gopass

go 1.20

Expand Down
Loading

0 comments on commit ce74dde

Please sign in to comment.