-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,445 additions
and
62 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
use utf8; | ||
|
||
use URI::VersionRange::App; | ||
|
||
exit URI::VersionRange::App->run(@ARGV) unless caller(); | ||
|
||
1; | ||
|
||
__END__ | ||
=encoding utf-8 | ||
=head1 NAME | ||
vers-tool - Version Range tool | ||
=head1 SYNOPSIS | ||
vers-tool [OPTIONS]...STRING | ||
vers-tool STRING --contains STRING | ||
vers-tool [--help|--man|-v] | ||
Options: | ||
--help Brief help message | ||
--man Full documentation | ||
-v Print version | ||
--contains=VERSION Check if a version is contained within a range | ||
--format=FORMAT Output format | ||
--json JSON output format (--format=json) | ||
-h, --human-readable Human-readable format (--format=human-readable) | ||
Examples: | ||
Decode a "vers" string: | ||
vers-tool "vers:cpan/1.00|>=2.00|<5.00" | jq | ||
Check if a version is contained within a range: | ||
vers-tool "vers:cpan/1.00|>=2.00|<5.00" --contains "2.20" | ||
Humanize "vers": | ||
vers-tool "vers:cpan/1.00|>=2.00|<5.00" --human-readable | ||
=head1 DESCRIPTION | ||
C<vers-tool> Version Range tool | ||
=head1 EXAMPLES | ||
Decode a "vers" string: | ||
vers-tool "vers:cpan/1.00|>=2.00|<5.00" | jq | ||
Check if a version is contained within a range: | ||
vers-tool "vers:cpan/1.00|>=2.00|<5.00" --contains "2.20" | ||
Humanize "vers": | ||
vers-tool "vers:cpan/1.00|>=2.00|<5.00" --human-readable | ||
=head1 AUTHOR | ||
L<Giuseppe Di Terlizzi|https://metacpan.org/author/gdt> | ||
=head1 COPYRIGHT AND LICENSE | ||
Copyright © 2022-2024 L<Giuseppe Di Terlizzi|https://metacpan.org/author/gdt> | ||
You may use and distribute this module according to the same terms | ||
that Perl is distributed under. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package URI::VersionRange::Version::generic { | ||
|
||
use Version::libversion::XS; | ||
|
||
use parent 'URI::VersionRange::Version'; | ||
use overload ('cmp' => \&compare, '<=>' => \&compare, fallback => 1); | ||
|
||
sub compare { | ||
my ($left, $right) = @_; | ||
return version_compare2($left->[0], $right->[0]); | ||
} | ||
|
||
} | ||
|
||
package URI::VersionRange::Version::rpm { | ||
|
||
use RPM4; | ||
|
||
use parent 'URI::VersionRange::Version'; | ||
use overload ('cmp' => \&compare, '<=>' => \&compare, fallback => 1); | ||
|
||
sub compare { | ||
my ($left, $right) = @_; | ||
return rpmvercmp($left->[0], $right->[0]); | ||
} | ||
|
||
} | ||
|
||
1; |
Oops, something went wrong.