Skip to content
This repository was archived by the owner on May 22, 2023. It is now read-only.

Commit db9fea5

Browse files
authored
Merge pull request #568 from keep-network/signing-cli-improvements
Improvements of the signing CLI
2 parents 88b54e9 + dec80cf commit db9fea5

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

cmd/signing.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import (
99
"sync"
1010
"time"
1111

12-
"github.com/ipfs/go-log"
13-
12+
"github.com/keep-network/keep-common/pkg/logging"
1413
"github.com/keep-network/keep-core/pkg/net"
1514
"github.com/keep-network/keep-core/pkg/net/key"
1615
"github.com/keep-network/keep-core/pkg/net/local"
@@ -33,7 +32,8 @@ func init() {
3332
Name: "signing",
3433
Usage: "Provides several tools useful for out-of-band signing",
3534
Before: func(c *cli.Context) error {
36-
_ = log.SetLogLevel("*", "fatal") // disable the regular logger
35+
// disable the regular logger
36+
_ = logging.Configure("keep*=fatal")
3737
return nil
3838
},
3939
Subcommands: []cli.Command{
@@ -110,17 +110,7 @@ func DecryptKeyShare(c *cli.Context) error {
110110
)
111111
}
112112

113-
_, err = os.Stdout.Write(signerBytes)
114-
if err != nil {
115-
return fmt.Errorf(
116-
"could not write signer bytes to stdout: [%v]",
117-
err,
118-
)
119-
}
120-
121-
outputFilePath := c.String("output-file")
122-
123-
if len(outputFilePath) > 0 {
113+
if outputFilePath := c.String("output-file"); len(outputFilePath) > 0 {
124114
if _, err := os.Stat(outputFilePath); !os.IsNotExist(err) {
125115
return fmt.Errorf(
126116
"could not write shares to file; file [%s] already exists",
@@ -136,6 +126,14 @@ func DecryptKeyShare(c *cli.Context) error {
136126
err,
137127
)
138128
}
129+
} else {
130+
_, err = os.Stdout.Write(signerBytes)
131+
if err != nil {
132+
return fmt.Errorf(
133+
"could not write signer bytes to stdout: [%v]",
134+
err,
135+
)
136+
}
139137
}
140138

141139
return nil

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ func main() {
6565

6666
err = app.Run(os.Args)
6767
if err != nil {
68-
logger.Fatal(err)
68+
fmt.Print(err)
6969
}
7070
}

0 commit comments

Comments
 (0)