[pkg-haskell-tools] 01/03: dht: sort subcommands alphabetically
Joachim Breitner
nomeata at moszumanska.debian.org
Tue Aug 18 10:17:19 UTC 2015
This is an automated email from the git hooks/post-receive script.
nomeata pushed a commit to branch master
in repository pkg-haskell-tools.
commit c64d8d01472e1ca5da717b373b970c9805677d87
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Tue Aug 18 12:00:52 2015 +0200
dht: sort subcommands alphabetically
---
dht | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/dht b/dht
index bcf0be1..1181348 100755
--- a/dht
+++ b/dht
@@ -22,13 +22,14 @@ if ($Bin eq "/usr/bin") {
$ENV{DHT_SCRIPT_DIR} = $DHT_SCRIPT_DIR;
-our @DHT_SCRIPT_DIR = ();
+our @DHT_SCRIPTS = ();
opendir(DIR, $DHT_SCRIPT_DIR) or die $!;
while (my $file = readdir(DIR)) {
next if ($file =~ m/^\./);
- push @DHT_SCRIPT_DIR, $file;
+ push @DHT_SCRIPTS, $file;
}
closedir(DIR);
+ at DHT_SCRIPTS = sort @DHT_SCRIPTS;
if (not @ARGV or $ARGV[0] eq "--help" or $ARGV[0] eq "-h" ) {
@@ -42,7 +43,7 @@ less useful tools.
Supported subcommands:
__END__
- for my $script (@DHT_SCRIPT_DIR) {
+ for my $script (@DHT_SCRIPTS) {
# print first line of help
open (HELP, '-|', "$DHT_SCRIPT_DIR/$script", "--help") or die $!;
print " " . (scalar(<HELP>) || "$script --help failed");
@@ -77,7 +78,7 @@ Supported subcommands:
__END__
- for my $script (@DHT_SCRIPT_DIR) {
+ for my $script (@DHT_SCRIPTS) {
# print first line of help
open (HELP, '-|', "$DHT_SCRIPT_DIR/$script", "--help") or die $!;
print " * " . (scalar(<HELP>) || "$script --help failed");
@@ -90,7 +91,7 @@ __END__
__END__
- for my $script (@DHT_SCRIPT_DIR) {
+ for my $script (@DHT_SCRIPTS) {
print <<__END__;
## dht $script
@@ -108,7 +109,7 @@ if (not @ARGV or $ARGV[0] eq "--version" ) {
}
my $cmd = shift @ARGV;
-unless ($cmd ~~ @DHT_SCRIPT_DIR) {
+unless ($cmd ~~ @DHT_SCRIPTS) {
print "Subcommand $cmd not known.\n";
print "Run $0 to see a list of supported commands.\n";
exit(1)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/pkg-haskell-tools.git
More information about the Pkg-haskell-commits
mailing list