Permalink
Browse files

Add `zef --version`

Requires rakudo 2019.01 or newer

Resolves #122
  • Loading branch information...
ugexe committed Jan 18, 2019
1 parent a45632a commit e2954b86440be5588cb275edb1b3ccfb7a2bb63d
Showing with 17 additions and 0 deletions.
  1. +3 −0 .appveyor.yml
  2. +3 −0 .travis.yml
  3. +1 −0 README.pod
  4. +10 −0 lib/Zef/CLI.pm6
@@ -18,6 +18,8 @@ install:
build: off

test_script:
- perl6 -I. bin/zef --version

# run xtests
- perl6 -I. xt/repository.t
- perl6 -I. xt/install.t
@@ -41,6 +43,7 @@ test_script:
- zef update

# test informational commands
- zef --version
- zef --help
- zef locate Zef::CLI
- zef locate lib/Zef/CLI.pm6
@@ -33,6 +33,8 @@ install:
- perl6 -v

script:
- perl6 -I. bin/zef --version

# run xtests
- perl6 -I. xt/repository.t
- perl6 -I. xt/install.t
@@ -56,6 +58,7 @@ script:
- zef update

# test informational commands
- zef --version
- zef --help
- zef locate Zef::CLI
- zef locate lib/Zef/CLI.pm6
@@ -26,6 +26,7 @@ To install via rakudobrew, please use the following command:
=head1 USAGE

zef --help
zef --version

# install the CSV::Parser distribution
zef install CSV::Parser
@@ -14,6 +14,7 @@ package Zef::CLI {
my $verbosity = preprocess-args-verbosity-mutate(@*ARGS);
%*ENV<ZEF_BUILDPM_DEBUG> = $verbosity >= DEBUG;
my $CONFIG = preprocess-args-config-mutate(@*ARGS);
my $VERSION = try EVAL q[$?DISTRIBUTION.meta<ver version>.first(*.so)];

# TODO: deprecate usage of --depsonly
@*ARGS = @*ARGS.map: { $_ eq '--depsonly' ?? '--deps-only' !! $_ }
@@ -695,6 +696,15 @@ package Zef::CLI {
exit 0;
}

#| Detailed version information
multi MAIN(Bool :$version where .so) {
say $*PERL.compiler.version < v2019.01
?? 'Version detection requires rakudo v2019.01 or newer'
!! ($VERSION // 'unknown');

exit 0;
}

multi MAIN(Bool :h(:$help)?) {
note qq:to/END_USAGE/
Zef - Perl6 Module Management

0 comments on commit e2954b8

Please sign in to comment.