Skip to content

Instantly share code, notes, and snippets.

@snarkyboojum
Created January 12, 2011 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snarkyboojum/775953 to your computer and use it in GitHub Desktop.
Save snarkyboojum/775953 to your computer and use it in GitHub Desktop.
From b19316d64f5571ad9b23be2af1fba24d96ae4e3c Mon Sep 17 00:00:00 2001
From: snarkyboojum <snarkyboojum@gmail.com>
Date: Wed, 12 Jan 2011 20:49:18 +1100
Subject: [PATCH] Added a basic --info switch
---
bin/neutro | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/bin/neutro b/bin/neutro
index 056ead7..e930a04 100755
--- a/bin/neutro
+++ b/bin/neutro
@@ -122,6 +122,24 @@ package Ecosystem {
}
}
+ # Display info about a module or modules
+ #
+ our sub info (@modules) {
+ for @modules -> $m {
+ if %modules.exists($m) {
+ for %modules{$m}.kv -> $k, $v {
+ next if $v eq '';
+ printf "%-10s\t%s\n", $k.ucfirst, $v;
+ }
+ }
+ else {
+ say "Module $m not found in the ecosystem";
+ }
+
+ print "\n";
+ }
+ }
+
#
# Print a list of available modules
#
@@ -252,6 +270,7 @@ sub MAIN (Bool :$v = False,
Bool :$nodeps = False,
Bool :$notest = False,
Bool :$update = False,
+ Bool :$info = False,
*@args) {
Ecosystem::init();
@@ -263,9 +282,10 @@ sub MAIN (Bool :$v = False,
$update && Ecosystem::updatedb();
$list && Ecosystem::listmodules();
$listinst && Ecosystem::listinstalled();
+ $info && Ecosystem::info(@args);
- @args».&install;
- if none(+@args, $listinst, $list, $update) { say "Nothing to do" }
+ @args».&install unless $info;
+ if none(+@args, $info, $listinst, $list, $update) { say "Nothing to do" }
}
sub USAGE {
@@ -276,6 +296,7 @@ Options:
--help Display this message and quit
--list List the available packages
--listinst List the installed packages (installed by/known to neutro)
+ --info Display information on a specific module(s)
--nodeps Don't install dependencies of modules
--notest Don't run unit tests for modules
--update Update the module database
--
1.7.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment