mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
cmd/abigen: allow using abigen --pkg flag with standard input (#19207)
This commit is contained in:
parent
a747a9861d
commit
b711dc811d
1 changed files with 3 additions and 8 deletions
|
|
@ -136,7 +136,7 @@ func abigen(c *cli.Context) error {
|
||||||
bins []string
|
bins []string
|
||||||
types []string
|
types []string
|
||||||
)
|
)
|
||||||
if c.String(solFlag.Name) != "" || c.String(vyFlag.Name) != "" || (c.String(abiFlag.Name) == "-" && c.String(pkgFlag.Name) == "") {
|
if c.String(solFlag.Name) != "" || c.String(vyFlag.Name) != "" || c.String(abiFlag.Name) == "-" {
|
||||||
// Generate the list of types to exclude from binding
|
// Generate the list of types to exclude from binding
|
||||||
exclude := make(map[string]bool)
|
exclude := make(map[string]bool)
|
||||||
for _, kind := range strings.Split(c.String(excFlag.Name), ",") {
|
for _, kind := range strings.Split(c.String(excFlag.Name), ",") {
|
||||||
|
|
@ -185,13 +185,8 @@ func abigen(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Otherwise load up the ABI, optional bytecode and type name from the parameters
|
// Otherwise load up the ABI, optional bytecode and type name from the parameters
|
||||||
var abi []byte
|
abi, err := os.ReadFile(c.String(abiFlag.Name))
|
||||||
var err error
|
|
||||||
if c.String(abiFlag.Name) == "-" {
|
|
||||||
abi, err = io.ReadAll(os.Stdin)
|
|
||||||
} else {
|
|
||||||
abi, err = os.ReadFile(c.String(abiFlag.Name))
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Failed to read input ABI: %v\n", err)
|
fmt.Printf("Failed to read input ABI: %v\n", err)
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue