Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

bind on init #450

Merged
merged 4 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ This will install the Arbiter binary on your machine. You can then run `arbiter

## Command Line Interface

The Arbiter binary provides a CLI for creating new projects much like [Foundry](https://github.com/foundry-rs/foundry), which Arbiter aims to work alongside with. To create a new project, you can run:
The Arbiter binary provides a CLI for creating new projects much like [Foundry](https://github.com/foundry-rs/foundry), which Arbiter aims to work alongside with. This requires you to have foundry installed. If you do not have foundry installed you can install it [here](https://getfoundry.sh/). To create a new project, you can run:

```bash
arbiter init your-project-name
cd your-project-name
```

This initializes a new Arbiter project with a template. The next step require you to have foundry installed. If you do not have foundry installed you can install it [here](https://getfoundry.sh/). Then you can generate the template bindings by running:
This initializes a new Arbiter project with a template. You can generate the bindings again by running:

```bash
arbiter bind
Expand Down
23 changes: 23 additions & 0 deletions bin/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,29 @@ pub(crate) fn init_project(name: &str) -> io::Result<()> {
));
}

let output = Command::new("forge")
.arg("bind")
.arg("--revert-strings")
.arg("debug")
.arg("-b")
.arg("src/bindings/")
.arg("--module")
.arg("--overwrite")
.output()?;

if output.status.success() {
let output_str = String::from_utf8_lossy(&output.stdout);
println!("Command output: {}", output_str);
println!("Note: revert strings are on");
} else {
let err_str = String::from_utf8_lossy(&output.stderr);
println!("Command failed, error: {}, is forge installed?", err_str);
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
"Command failed",
));
}

println!(
"Your Arbiter project '{}' has been successfully initialized!",
name
Expand Down