Skip to content

Commit

Permalink
fix cligen command
Browse files Browse the repository at this point in the history
  • Loading branch information
ikehara committed Oct 21, 2019
1 parent bdbde66 commit 585c5a0
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 53 deletions.
3 changes: 0 additions & 3 deletions cmd/abigen/README.md

This file was deleted.

6 changes: 3 additions & 3 deletions cmd/abigen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ func Generate(outdir, pkg, name, abiJsonFilename string, mock bool) error {
} else if src, err := bind.Bind(pkg, name, string(abiJson), mock); err != nil {
return err
} else {
if err := os.MkdirAll(pkg, 0700); err != nil {
if err := os.MkdirAll(pkg, 0755); err != nil {
return err
}
if err := ioutil.WriteFile(path.Join(outdir, name+".go"), []byte(src), 0700); err != nil {
if err := ioutil.WriteFile(path.Join(outdir, name+".go"), []byte(src), 0644); err != nil {
return err
}
return nil
Expand All @@ -53,7 +53,7 @@ func Generate(outdir, pkg, name, abiJsonFilename string, mock bool) error {
func init() {
rootCmd.Flags().String("package", "contract", "package name")
rootCmd.Flags().String("name", "", "contract name")
rootCmd.Flags().String("abi", "example.json", "abi json")
rootCmd.Flags().String("abi", "", "abi json")
rootCmd.Flags().String("outdir", "", "output dir")
rootCmd.Flags().Bool("mock", false, "generate mock")
viper.AutomaticEnv()
Expand Down
4 changes: 0 additions & 4 deletions cmd/cligen/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions cmd/cligen/Makefile

This file was deleted.

32 changes: 0 additions & 32 deletions cmd/cligen/example/main.go

This file was deleted.

8 changes: 4 additions & 4 deletions cmd/cligen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func Generate(outdir, pkg, name, abiJsonFilename string) error {
} else if src, err := clibind.Bind(pkg, name, string(abiJson)); err != nil {
return err
} else {
if err := os.MkdirAll(outdir, 0700); err != nil {
if err := os.MkdirAll(outdir, 0755); err != nil {
return err
}
if err := ioutil.WriteFile(path.Join(outdir, name+".go"), []byte(boundSrc), 0700); err != nil {
if err := ioutil.WriteFile(path.Join(outdir, name+".go"), []byte(boundSrc), 0644); err != nil {
return err
}
if err := ioutil.WriteFile(path.Join(outdir, name+"cmd.go"), []byte(src), 0700); err != nil {
if err := ioutil.WriteFile(path.Join(outdir, name+"cmd.go"), []byte(src), 0644); err != nil {
return err
}
return nil
Expand All @@ -59,7 +59,7 @@ func Generate(outdir, pkg, name, abiJsonFilename string) error {
func init() {
rootCmd.Flags().String("package", "contract", "package name")
rootCmd.Flags().String("name", "", "contract name")
rootCmd.Flags().String("abi", "example.json", "abi json")
rootCmd.Flags().String("abi", "", "abi json")
rootCmd.Flags().String("outdir", "", "output dir")
viper.AutomaticEnv()
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
Expand Down

0 comments on commit 585c5a0

Please sign in to comment.