style: change space to tab for goreport

This commit is contained in:
Adrien Waksberg 2019-08-31 19:18:35 +02:00
parent 30ada1a1fc
commit 3f9d4850b6
13 changed files with 853 additions and 842 deletions

View file

@ -17,6 +17,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
- Export in a file - Export in a file
- Use RandomString function for wallet's salt - Use RandomString function for wallet's salt
- Search is case insensite - Search is case insensite
- change space to tab for goreport
## v1.1.0 - 2019-07-23 ## v1.1.0 - 2019-07-23

View file

@ -1,8 +1,9 @@
# gpm: Go Passwords Manager # gpm: Go Passwords Manager
[![Version](https://img.shields.io/badge/latest_version-1.1.0-green.svg)](https://git.yaegashi.fr/nishiki/gpm/releases) [![Version](https://img.shields.io/badge/latest_version-1.1.0-green.svg)](https://git.yaegashi.fr/nishiki/gpm/releases)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://git.yaegashi.fr/nishiki/gpm/src/branch/master/LICENSE)
[![Build Status](https://travis-ci.org/nishiki/gpm.svg?branch=master)](https://travis-ci.org/nishiki/gpm) [![Build Status](https://travis-ci.org/nishiki/gpm.svg?branch=master)](https://travis-ci.org/nishiki/gpm)
[![GoReport](https://goreportcard.com/badge/git.yaegashi.fr/nishiki/gpm)](https://goreportcard.com/report/git.yaegashi.fr/nishiki/gpm)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://git.yaegashi.fr/nishiki/gpm/src/branch/master/LICENSE)
gpm is passwords manager write in go and use AES-256 to encrypt the wallets gpm is passwords manager write in go and use AES-256 to encrypt the wallets

View file

@ -17,13 +17,13 @@ package gpm
import ( import (
"bufio" "bufio"
"fmt" "fmt"
"github.com/atotto/clipboard"
"github.com/olekukonko/tablewriter"
"golang.org/x/crypto/ssh/terminal"
"io/ioutil" "io/ioutil"
"os" "os"
"strconv" "strconv"
"syscall" "syscall"
"github.com/atotto/clipboard"
"github.com/olekukonko/tablewriter"
"golang.org/x/crypto/ssh/terminal"
) )
// Cli contain config and wallet to use // Cli contain config and wallet to use
@ -40,7 +40,11 @@ func (c *Cli) printEntries(entries []Entry) {
tables = make(map[string]*tablewriter.Table) tables = make(map[string]*tablewriter.Table)
for i, entry := range entries { for i, entry := range entries {
if entry.OTP == "" { otp = "" } else { otp = "X" } if entry.OTP == "" {
otp = ""
} else {
otp = "X"
}
if _, present := tables[entry.Group]; present == false { if _, present := tables[entry.Group]; present == false {
tables[entry.Group] = tablewriter.NewWriter(os.Stdout) tables[entry.Group] = tablewriter.NewWriter(os.Stdout)
tables[entry.Group].SetHeader([]string{"", "Name", "URI", "User", "OTP", "Comment"}) tables[entry.Group].SetHeader([]string{"", "Name", "URI", "User", "OTP", "Comment"})

View file

@ -16,9 +16,9 @@ package gpm
import ( import (
"crypto/aes" "crypto/aes"
"crypto/sha512"
"crypto/cipher" "crypto/cipher"
"crypto/rand" "crypto/rand"
"crypto/sha512"
"encoding/base64" "encoding/base64"
"io" "io"
mrand "math/rand" mrand "math/rand"
@ -89,9 +89,15 @@ func RandomString(length int, letter bool, digit bool, special bool) string {
chars := "" chars := ""
randomString := make([]byte, length) randomString := make([]byte, length)
if letter { chars = chars + letters } if letter {
if digit { chars = chars + digits } chars = chars + letters
if special { chars = chars + specials } }
if digit {
chars = chars + digits
}
if special {
chars = chars + specials
}
if !letter && !digit && !special { if !letter && !digit && !special {
chars = digits + letters chars = digits + letters
} }

View file

@ -16,8 +16,8 @@ package gpm
import ( import (
"fmt" "fmt"
"time"
"net/url" "net/url"
"time"
"github.com/pquerna/otp/totp" "github.com/pquerna/otp/totp"
) )

View file

@ -15,8 +15,8 @@
package gpm package gpm
import ( import (
"fmt"
"flag" "flag"
"fmt"
"os" "os"
) )

View file

@ -20,12 +20,11 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"regexp" "regexp"
"time"
"sort" "sort"
"strings" "strings"
"time"
) )
// WalletFile contains the data in file // WalletFile contains the data in file
type WalletFile struct { type WalletFile struct {
Salt string Salt string

View file

@ -2,8 +2,8 @@ package gpm
import ( import (
"fmt" "fmt"
"os"
"io/ioutil" "io/ioutil"
"os"
"testing" "testing"
) )