File: list-tasks

package info (click to toggle)
feta 1.4.15
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 444 kB
  • ctags: 85
  • sloc: perl: 1,200; sh: 192; makefile: 55
file content (41 lines) | stat: -rwxr-xr-x 927 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl -w
# Copyright (c)2001-2002 Joe Wreschnig
# A Feta plugin to list tasks.
# Licensed under the GNU GPL.

use Getopt::Std;
use strict;

my %opts; getopts('tyqV', \%opts);

if (!$opts{'q'}) { open(QUIET, ">&STDOUT"); }
else { open(QUIET, ">>/dev/null"); }

if (!@ARGV) {
 print QUIET "Please wait... searching for all task names.\n\n";
 my (@tasks, %tasks);
 foreach (`feta search Task: . Task:`) {
  push (@tasks, split (/, /, $_));
 }
 chomp @tasks;
 print QUIET "All available tasks:\n";
 foreach (@tasks) { $tasks{$_} = 1; } # Hack. It's like uniq.
 foreach (sort keys %tasks) {
  print "$_\n";
 }
} else {
 foreach (@ARGV) {
  print QUIET "Looking for packages in the $_ task...\n";
  my @packages = `feta search Task: $_`;
  if (!@packages) {
   print QUIET "There is no task named $_.\n";
  } else {
   print "\n";
   chomp @packages;
   foreach (@packages) {
    print "$_\n";
   }
   print "\n";
  }
 }
}