-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add a list command #159
Add a list command #159
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
# HashIdentifier.list | ||
# # => ["CRC-16", "CRC-16-CCITT", "FCS-16", "Adler-32", "CRC-32B", "FCS-32"] | ||
def list | ||
(PROTOTYPES.flat_map { |d| d["modes"].map { |m| m["name"]}} + COMMONS).uniq |
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.
COMMONS is a subset of PROTOTYPES hash types so it should not add more types. In practice there is a slight difference because at some point PROTOTYPES was updated while COMMONS was not, so I'll make sure to make the changes on it. So commons can be removed.
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.
Also I added a .sort
# # => ["CRC-16", "CRC-16-CCITT", "FCS-16", "Adler-32", "CRC-32B", "FCS-32"] | ||
def list | ||
(PROTOTYPES.flat_map { |d| d["modes"].map { |m| m["name"]}} + COMMONS).uniq | ||
end |
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.
I checked the linting rules with bundle exec rubocop
and had to make some changes. Some dev commands are displayed here: https://noraj.github.io/haiti/#/pages/publishing
@@ -15,6 +15,7 @@ Usage: | |||
|
|||
Commands: | |||
samples Display hash samples for the given type | |||
list Display array list of available types |
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.
The change in lib/haiti.rb
actually added the feature in the lib but some changes have to be made in bin/haiti
too. In order to add the command to the CLI.
@@ -15,6 +15,7 @@ Usage: | |||
|
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.
LIke them samples
command, the list
one need to be added to docopt else it won't be parsed.
# @example | ||
# HashIdentifier.list | ||
# # => ["CRC-16", "CRC-16-CCITT", "FCS-16", "Adler-32", "CRC-32B", "FCS-32"] | ||
def list |
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.
My bad the description list all, common, with or without ref, extended or not.
was not clear enough, but I expected to have parameters to filter. Eg. displaying the extended hash types or only the common ones, etc. all the same options as for the default identifying method.
WHAT
list all, common, with or without ref, extended or not.
ISSUE
FIX #155