Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cmd/cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func ReadKeyConfig(context string, config *Config) (string, error) {
if err != nil {
return "", err
}
if config.keyConfig.Key == "" {
if config.keyConfig == nil || config.keyConfig.Key == "" {
return "", errors.New("malformed key configuration file, please regenerate the key")
}

Expand Down
6 changes: 5 additions & 1 deletion pkg/cmd/cli/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ func (c *CreateCmd) Run(cli *CmdContext) error {

fmt.Println("The following key has been generated and saved to: ", cli.config.configPath)
} else {
fmt.Printf("Key already exists at: %s. Use --force to overwrite.\n", cli.config.configPath)
fmt.Printf(`Key already exists at: %s.

!!CAUTION!!
You may overwrite this existing key but this action is irreversible and may invalidate any PAIR clean rooms that are currently in progress. Use --force to proceed with overwriting.
`, cli.config.configPath)
}

return nil
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"optable-pair-cli/pkg/cmd/cli"
"path/filepath"

"github.com/adrg/xdg"
"github.com/alecthomas/kong"
Expand All @@ -24,7 +25,7 @@ https://github.com/Optable/match/blob/main/pkg/pair/README.md and
https://iabtechlab.com/pair/
`

const keyConfigPath = "opair/key/key.json"
var keyConfigPath = filepath.Join("opair", "key", "key.json")

func main() {
var c cli.Cli
Expand Down
5 changes: 3 additions & 2 deletions pkg/pair/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"optable-pair-cli/pkg/io"
"optable-pair-cli/pkg/keys"
"os"
"path/filepath"
"runtime"
"strings"
"sync/atomic"
Expand Down Expand Up @@ -104,8 +105,8 @@ func (w *writer) NewWriter(index int) (*csv.Writer, error) {
return csv.NewWriter(os.Stdout), nil
}

p := strings.TrimRight(w.path, "/")
f, err := os.Create(fmt.Sprintf("%s/result_%d.csv", p, index))
p := strings.TrimRight(w.path, string(filepath.Separator))
f, err := os.Create(filepath.Join(p, fmt.Sprintf("result_%d.csv", index)))
if err != nil {
return nil, err
}
Expand Down