Require a target language for interface generation - #47
Merged
Merged
Conversation
The metadata argument and output option are now declared on the csharp and python commands rather than on their parent, so the target language is named before the metadata path. Naming the language is now required, so generate interface reports that a command was not provided instead of generating the .NET interface. The python command no longer declares a --namespace option, so help states the options that apply to each target and the validator rejecting the option is gone. The metadata argument is renamed from metadataPath to metadata.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
generate interfacedeclared the device metadata as a positional argument on the parent command and the target language as a subcommand, so the only accepted order was the path followed by the language. Typing the language first would printUnrecognized command or argument 'nope.yml'followed byFile does not exist: 'device.yml', naming a file that was never typed.System.CommandLinemakes options recursive but not arguments, so a shared argument has to sit on the parent, and a parent argument has to be consumed before the subcommand token. The order was forced by where the argument was originally declared.MetadataPathArgumentandOutputPathOptionare now constructed insidecsharpandpython, and the parent keeps no argument, no options and no action. The natural order works, and the path stays optional, still defaulting todevice.ymlin the current directory.Naming the language is now required
generate interfacewith no language generated the .NET interface. It now reportsRequired command was not provided.with the help listing both targets, and exits 1. No compatibility shim is available, since a default action cannot be hidden the way the firmware path option was hidden in 1bb814b.The .NET and Python targets are equals now that Harp Python is a first-class target.
Options are declared per target
--namespacewas declared on the parent withRecursive = trueand then rejected onpythonby a hand-written validator.pythonnow declares no such option, so--helpstates the options that apply to each target and the validator is gone. The error for--namespaceon Python is correspondingly the parser default, which reads the option as the metadata path and reports a missing file.generate firmwarealready answers an undeclared option the same way.The parent description also described the C# output, "Generate reactive programming API and async API", including an async API the Python target does not generate. It now reads "Generate device interface code for a target language", and
csharpcarries the original text.The metadata argument is renamed from
metadataPathtometadata, matchingverify --metadataand naming the content rather than the kind of value.docs/README.mdanddocs/articles/generate.mdare updated for the new order and for the removed default.