-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
cli
invocation from nimscript (#109)
* Fix `cli` invocation from nimscript When calling `cli` macro from nimscript, there are compilation issues: - `nim-faststreams` is not available, therefore, `nim-serialization` does not work, due to `equalMem` being gated behind `notJSnotNims`. Dropping support for config files in nimscript contexts fixes that. - `std/strformat` raises `ValueError` for invalid format strings, but does so at runtime rather than checking types at compiletime. As it is only used for simple string concatenation in error cases, changing to simple concatenation avoids verbose error handling. - `getAppFilename()` is unavailable in `nimscript`. This was already fixed by replacing it with `appInvocation()` but two instances of direct `getAppFilename()` calls remained in default arguments. This is fixed by changing those default arguments as well. - The `!= nil` check on the `proc` in `loadImpl` does not work when called from nimscript. This is fixed by changing to `isNil`. - Passing `addr result` around to internal templates correctly creates the config, but the object ultimately being returned is not the same. Passing `var result` directly through the templates ensures that the correct `result` gets modified and is clearer than implicit capture. Applying these fixes fixes running `.nims` files with `cli` macro. * Add debugging output on failure * Update confutils.nimble * Update confutils.nim
- Loading branch information
1 parent
9bf293e
commit cb858a2
Showing
2 changed files
with
79 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters