Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #1271
Adds the Clap arg
new
to create a new model crate, ex.:It creates a new folder
my_new_model
with the package/crate with the same name. The crate is based on the official examplemodels/star
.Tested on Windows 10 and Kubuntu with
cargo run
.The code is based on MoonZoon CLI tool mzoon with removed
async
support.Logic: The example
models/star
(aka template) is packed to a Tar archive and included infb-app
as bytes. Ignored files (hidden, gitignored) and some extra ones are not archived. When the arg--new
is processed, the archive is unpacked and files are postprocessed (for instance some text files are modified).Notes:
fb-app model new
could be a bit better than--new
.fj
to itsVERSION_PKG
in the new model package. We can add a new flag to don't do that so it's easier to test created packages. It looks like this inmzoon
P.S. The design & implementation of this feature is quite opinionated. Feel free to close the PR or create a new PR inspired by it. Don't hesitate to copy code from
mzoon
if it helps.