-
Notifications
You must be signed in to change notification settings - Fork 7
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
[RFC] nimibook cli design proposal #20
Comments
Certainly an interesting proposal, letting the user themselves build the CLI binary on a per-project basis solves a lot of problems :D I do feel like the |
This seem reasonable. |
no, never considered book.json as input for DSL, just a convienent way to pass around information from driver program to single document. |
Regarding clean, I also ignore files in #19 Does most of what you specified but without the ability to provide a path for now (but that shouldn't too hard to add with |
closing this and tracking lack of path here: #27 |
The following is my design idea for a cli-generating template
nimibookCli
that will allow to support deploy mechanism (see discussions in #12, #19).nbook.nim
main file for managing a nimibook project should be a
nbook.nim
(renamedgenbook
since it will do more) with the following structure:Note that the cli should be a real cli and not based on compile time switches as currently is. This means in particular that unless the toc or book configuration change, there is no need to recompile.
The user starting from an empty repository and adding a file with the above content, should be able to call the following commands with the generated cli (after calling
nim c nbook
or calling directlynim r nbook <command>
).nbook init
On first call it will create the initial folder structure:
Inside
book
folder it will create appropriatenim
andmd
files reflecting current toc.On subsequent call it will not overwrite existing files. So if init is already called once it will likely only add new files if they have been added to the toc. If you provide a folder or file it will restrict the init operation to that specific folder or file.
nbook check
It will check that current folder structure reflects book toc, configuration (and the internal nimibook assets). It will also lists any other files that are not reflected in current structure.
You should be able to provide a path (folder or file) and the check operation should be restricted to that folder or file.
nbook clean
It will remove all files that should not be represented by current structure. It will also remove outputs of build process (e.g.
book.json
and html files). It should have a mechanism to protect specific files or folders (some api that you put in nimibook? something likebook.keep = @["somefolder", "some/file.nim", ...]
). You should be able to provide a path (folder or file) and the clean operation should be restricted to that folder (or file).nbook build
It will build the book output starting from the toc and generating all files. If you provide a folder or a file it will restrict the build operation only to that folder or file.
nbook update
Same as init but it will overwrite the content instead of doing nothing in the case that a file exists.
The text was updated successfully, but these errors were encountered: