mirror of
https://github.com/mitchell/selfpass.git
synced 2025-12-13 21:07:22 +00:00
Refactored Docker and Make files; increased command context timeouts;
add dockerignore
This commit is contained in:
parent
db246df3d6
commit
b76d5dffa3
7 changed files with 34 additions and 15 deletions
|
|
@ -91,7 +91,7 @@ password.`,
|
|||
check(survey.AskOne(prompt, &cpass, nil))
|
||||
|
||||
if ci.Password != cpass {
|
||||
fmt.Println("passwords didn't match'")
|
||||
fmt.Println("passwords didn't match")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ password.`,
|
|||
}
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||
defer cancel()
|
||||
|
||||
c, err := initClient(ctx).Create(ctx, ci)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ func MakeDelete(initConfig CredentialClientInit) *cobra.Command {
|
|||
check(survey.AskOne(prompt, &confirmed, nil))
|
||||
|
||||
if confirmed {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||
defer cancel()
|
||||
|
||||
check(initConfig(ctx).Delete(ctx, args[0]))
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ decrypting password.`,
|
|||
Args: cobra.ExactArgs(1),
|
||||
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
||||
defer cancel()
|
||||
|
||||
cred, err := initClient(ctx).Get(ctx, args[0])
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ package commands
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"gopkg.in/AlecAivazis/survey.v1"
|
||||
)
|
||||
|
||||
func MakeList(initClient CredentialClientInit) *cobra.Command {
|
||||
|
|
@ -18,13 +20,14 @@ func MakeList(initClient CredentialClientInit) *cobra.Command {
|
|||
includes almost all the information but the most sensitive.`,
|
||||
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
|
||||
defer cancel()
|
||||
|
||||
ctx := context.Background()
|
||||
mdch, errch := initClient(ctx).GetAllMetadata(ctx, sourceHost)
|
||||
|
||||
fmt.Println()
|
||||
|
||||
receive:
|
||||
for {
|
||||
for count := 0; ; count++ {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
check(fmt.Errorf("context timeout"))
|
||||
|
|
@ -37,6 +40,20 @@ includes almost all the information but the most sensitive.`,
|
|||
break receive
|
||||
}
|
||||
|
||||
if count != 0 && count%3 == 0 {
|
||||
var proceed bool
|
||||
prompt := &survey.Confirm{Message: "Next page?", Default: true}
|
||||
check(survey.AskOne(prompt, &proceed, nil))
|
||||
|
||||
if !proceed {
|
||||
break receive
|
||||
}
|
||||
|
||||
clearCmd := exec.Command("clear")
|
||||
clearCmd.Stdout = os.Stdout
|
||||
check(clearCmd.Run())
|
||||
}
|
||||
|
||||
fmt.Println(md)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue