diff options
author | Philip Schlump <pschlump@gmail.com> | 2018-10-06 22:27:12 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2018-10-06 22:27:12 +0800 |
commit | f95811e65bcc674ae32c19c043b29226a56a6a5f (patch) | |
tree | d56419a237cb1d529153dc6da782b18c921dfbe5 /cmd | |
parent | 5ed3960b9b2f699233452fb8445c5f9feb281f78 (diff) | |
download | dexon-f95811e65bcc674ae32c19c043b29226a56a6a5f.tar dexon-f95811e65bcc674ae32c19c043b29226a56a6a5f.tar.gz dexon-f95811e65bcc674ae32c19c043b29226a56a6a5f.tar.bz2 dexon-f95811e65bcc674ae32c19c043b29226a56a6a5f.tar.lz dexon-f95811e65bcc674ae32c19c043b29226a56a6a5f.tar.xz dexon-f95811e65bcc674ae32c19c043b29226a56a6a5f.tar.zst dexon-f95811e65bcc674ae32c19c043b29226a56a6a5f.zip |
cmd/abigen: support for --type flag with piped data (#17648)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/abigen/main.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go index 3ac37ba7a..d19164b18 100644 --- a/cmd/abigen/main.go +++ b/cmd/abigen/main.go @@ -75,7 +75,7 @@ func main() { bins []string types []string ) - if *solFlag != "" || *abiFlag == "-" { + if *solFlag != "" || (*abiFlag == "-" && *pkgFlag == "") { // Generate the list of types to exclude from binding exclude := make(map[string]bool) for _, kind := range strings.Split(*excFlag, ",") { @@ -111,7 +111,13 @@ func main() { } } else { // Otherwise load up the ABI, optional bytecode and type name from the parameters - abi, err := ioutil.ReadFile(*abiFlag) + var abi []byte + var err error + if *abiFlag == "-" { + abi, err = ioutil.ReadAll(os.Stdin) + } else { + abi, err = ioutil.ReadFile(*abiFlag) + } if err != nil { fmt.Printf("Failed to read input ABI: %v\n", err) os.Exit(-1) @@ -155,6 +161,5 @@ func contractsFromStdin() (map[string]*compiler.Contract, error) { if err != nil { return nil, err } - return compiler.ParseCombinedJSON(bytes, "", "", "", "") } |