fetch.go 521 Bytes
Newer Older
Loïck Bonniot's avatar
Loïck Bonniot committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main

import (
	"fmt"
	"os"
	"path/filepath"

	"dfss/dfssc/sign"
)

func fetchContract(_ []string) {
	fmt.Println("Fetching a saved contract")

	var passphrase, uuid, directory string
	_ = readPassword(&passphrase, false)
	readStringParam("Contract UUID", "", &uuid)
	readStringParam("Save directory", ".", &directory)

	path := filepath.Join(directory, uuid+".json")
	err := sign.FetchContract(fca, fcert, fkey, addrPort, passphrase, uuid, path)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}