Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add stdin/out support #80

Open
frame-lang opened this issue Feb 3, 2022 · 5 comments
Open

Add stdin/out support #80

frame-lang opened this issue Feb 3, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@frame-lang
Copy link
Owner

Enable stdin/out as an option to support use cases for CLI as well as other tools.

@frame-lang frame-lang self-assigned this Feb 3, 2022
@frame-lang frame-lang added the enhancement New feature or request label Feb 3, 2022
@frame-lang
Copy link
Owner Author

@walkie I am actively investigating this now and interested in your perspective on how to handle this. I am thinking to follow the POSIX syntax:

I'm also thinking that -o could be used to specify a target file.

Thoughts? Also I am just looking into structopt now so if you have guidance on how this can be easily done LMK, otherwise I'll dig in (which isn't a bad thing).

Thanks!

@walkie
Copy link
Contributor

walkie commented Feb 9, 2022

For argument parsing, you should probably use clap instead of structopt since that seems to be the standard now. The structopt docs even have a note saying that it's now in maintence mode and to use clap instead.

I don't have any strong opinion on the syntax, but following a standard seems like a 👍 to me. The other option might just be to do whatever is most natural/easiest with clap, since that's likely to follow the most common practice. (Those two options might be the same, in which case, even better!)

@frame-lang
Copy link
Owner Author

@walkie So I now think the actual proper standard is that the absence of a filename is the indicator to read from stdin. However currently framec takes the language parameter as a positional parameter, just like the filename and therefore not really distinguishable (unless I'm missing some subtlety to this).

So I'm thinking to make the language a mandatory option with value so:

framec -l rust < Spec.frm

Would this break a lot of tooling on your side?

@walkie
Copy link
Contributor

walkie commented Feb 17, 2022

We're not using the CLI at all, so it won't impact us. We call Exe::run_file directly from a build.rs file.

Only tangentially related to the issue here, but we actually have several different build.rs files floating around for different projects that all do slight variants of the same thing. I'm currently abstracting the shared behavior out, and I plan to add it to the Frame repo as a new frame_build crate. I'll add a README to that describing our pattern for integrating Frame state machines into larger Rust projects, which might be helpful for others hoping to use Frame+Rust.

I'll let you merge the PR on that one since it adds a new crate to the repo.

@frame-lang
Copy link
Owner Author

frame-lang commented Feb 18, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants