about summary refs log tree commit diff
path: root/scripts/nix-channel.in
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-05-07T21·55-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-05-07T21·55-0400
commitafa7b8a479e48c5642a796563a615314c0261a1a (patch)
treefaace585ee0263dbe0f900b0ee9af08ae360ab6d /scripts/nix-channel.in
parent147f10157fef48dcf3e32511e10f5ee00026b757 (diff)
nix-channel --update: allow updating only the specified channels
Diffstat (limited to 'scripts/nix-channel.in')
-rwxr-xr-xscripts/nix-channel.in9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in
index 8f0fbbaa5097..6883ffd18db2 100755
--- a/scripts/nix-channel.in
+++ b/scripts/nix-channel.in
@@ -76,6 +76,8 @@ sub removeChannel {
 # Fetch Nix expressions and pull manifests from the subscribed
 # channels.
 sub update {
+    my @channelNames = @_;
+        
     readChannels;
 
     # Create the manifests directory if it doesn't exist.
@@ -87,6 +89,8 @@ sub update {
     # Download each channel.
     my $exprs = "";
     foreach my $name (keys %channels) {
+        next if scalar @channelNames > 0 && ! grep { $_ eq $name } @{channelNames};
+        
         my $url = $channels{$name};
         my $origUrl = "$url/MANIFEST";
 
@@ -141,7 +145,7 @@ Usage:
   nix-channel --add URL [CHANNEL-NAME]
   nix-channel --remove CHANNEL-NAME
   nix-channel --list
-  nix-channel --update
+  nix-channel --update [CHANNEL-NAME...]
 EOF
     exit 1;
 }
@@ -182,8 +186,7 @@ while (scalar @ARGV) {
     }
 
     elsif ($arg eq "--update") {
-        usageError if scalar @ARGV != 0;
-        update;
+        update(@ARGV);
         last;
     }