-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: add info command #101
Conversation
Previously, release info (setup.Release) parsing/reading logic was written in cmd/chisel/cmd_cut.go file. Being the only operation command before, it made sense to have it there. But, since there are incoming new commands, it is likely that this logic will be re-used. Thus, move it to a function, ``getRelease()``.
This commit adds functionalities to produce YAML outputs for ``setup.Package`` and ``setup.Slice`` objects.
This commit adds a new ``info`` command which shows detailed information about package slices. It accepts a white-space separated list of strings. The list can be composed of package names, slice names, or a combination of both. The default output format is YAML. When multiple package or slice names are provided, the output is a list of YAML documents, separated by three dashes (“---”). Slice definitions are shown verbatim according to their definition in the Chisel releases. For example, "globs" are not expanded. --- Usage: chisel info [info-OPTIONS] [<pkg|slice>...] [info command options] --release=<branch|dir> Chisel release branch or directory
ping @cjdcordeiro @woky @niemeyer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't find anything to nitpick on. LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just a few very nitty comments/suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noice :)
It lgtm but I'm just leaving a bunch of nitpicks :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks for the changes. it lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks very good. I left some small, mostly nitpicky, comments.
Instead of checking if the output YAML equals exactly to the expected YAML by string checking, parse both YAMLs instead. Then compare to see if they are equal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more minor comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this Rafid, LGTM, only a couple of nitpicks based on the latest changes and what we discussed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you all. This is looking pretty good already, but a few details need addressing:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good. Only remaining question is the mutability question that was already in the previous review. It changed, but it's not clear what is the real intention or the current state yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Rafid, one minor thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last minor things in the same spirit as one of the comments by Gustavo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you both.
This PR adds a new
info
command which shows detailed information about package slices.It accepts a white-space-separated list of strings. The list can be composed of package names, slice names, or a combination of both. The default output format is YAML. When multiple package or slice names are provided, the output is a list of YAML documents, separated by three dashes (“---”).
Slice definitions are shown verbatim according to their definition in the Chisel releases. For example, "globs" are not expanded.
Expand to see full specification
Command
Usage
Description
The info command shows detailed information about package slices in a Chisel release. It accepts a white-space separated list of strings. The list can be composed of package names, slice names, or a combination of both.The package slices are then looked for within the upstream chisel-releases repository.
The default output format is YAML. When multiple package/slice names are provided, the output is a list of YAML documents, separated by three dashes (“---”).
If no pkgs/slices are provided, it returns an error. At least one pkg/slicename is required.
If one or more pkgs/slices are provided, it returns a list of their slice definitions.
For slice names, it returns the corresponding package’s SDF, excluding any other package slices which have not been requested.
If multiple slices of the same package are provided, it returns the corresponding package’s SDF just once (i.e. the output can only have one YAML document per package, regardless of how many slices are specified).
If not all pkgs/slices can be found, it returns a list with slice definitions AND an error (to stderr), listing the pkgs/slices that could not be found.
If no packages can be found, it returns an error.
Slice definitions are shown verbatim according to their definition in the Chisel releases. E.g. expressions like globs are not expanded.
[info-OPTIONS]
(Optional) The
--release
option filters the search. It behaves similar to the--release
option to chisel cut. If unspecified, the ubuntu release will be parsed from the host OS. If an ubuntu-release is passed as the argument, the find command only searches for slices in that release branch. If a path to a chisel-release directory is passed as the argument, it parses the directory as a chisel-release and only searches for available slices in that directory.Examples
Additional information