Skip to content

Commit

Permalink
Merge pull request #21 from blocklessnetwork/feature/output_name
Browse files Browse the repository at this point in the history
support define output name.
  • Loading branch information
Joinhack authored Nov 20, 2024
2 parents 27ca390 + 4198e84 commit b13792f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tools/c2w/c2w.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
"path/filepath"
"time"

c2w "github.com/blocklessnetwork/bls-c2w"
blsc2w "github.com/blocklessnetwork/bls-c2w"
"github.com/containerd/containerd/archive"
"github.com/urfave/cli"
)

const defaultOutputFile = "bls-out.wasm"

var dockerfile = c2w.Dockerfile
var dockerfile = blsc2w.Dockerfile

func main() {
app := cli.NewApp()
Expand Down Expand Up @@ -57,6 +57,7 @@ func main() {

func action(clicontext *cli.Context) error {
arg1 := clicontext.Args().First()
outputPath := clicontext.Args().Get(1)
if arg1 == "" {
return fmt.Errorf("specify image name")
}
Expand All @@ -78,6 +79,16 @@ func action(clicontext *cli.Context) error {
if err := preparedImage(builderPath, srcImgName, srcImgPath, clicontext.String("target-arch")); err != nil {
return fmt.Errorf("failed to prepare image: %w", err)
}
if outputPath != "" {
d, f := filepath.Split(outputPath)
destDir, err = filepath.Abs(d)
if err != nil {
return err
}
if f != "" {
destFile = f
}
}
return build(builderPath, srcImgPath, destDir, destFile, clicontext)
}

Expand Down

0 comments on commit b13792f

Please sign in to comment.