Bladeren bron

More work on the sshfs helper

Samuel W. Flint 8 jaren geleden
bovenliggende
commit
259189f855
1 gewijzigde bestanden met toevoegingen van 17 en 2 verwijderingen
  1. 17 2
      sshfs-helper

+ 17 - 2
sshfs-helper

@@ -10,7 +10,7 @@ my $configData;
 
 
 if ((not -e $configFile)) {
 if ((not -e $configFile)) {
     $configData = {};
     $configData = {};
-    DumpFile($configFile);
+    DumpFile($configFile, $configData);
 } else {
 } else {
      $configData = LoadFile($configFile);
      $configData = LoadFile($configFile);
 }
 }
@@ -31,8 +31,14 @@ sub unmount {
     
     
 }
 }
 
 
+sub list {
+    foreach my $name (keys %{$configData}) {
+        print " - ${name}\n";
+    }
+}
+
 sub usage {
 sub usage {
-    print "sshfs-helper [ add | edit name | mount name | unmount name | help ]\n";
+    print "sshfs-helper [ add | list | edit name | mount name | unmount name | help ]\n";
 }
 }
 
 
 sub help {
 sub help {
@@ -43,10 +49,17 @@ EOF
     exit 1;
     exit 1;
 }
 }
 
 
+if (@ARGV == 0) {
+    usage();
+    exit 1;
+}
 my $command = shift @ARGV;
 my $command = shift @ARGV;
 my @arguments = @ARGV;
 my @arguments = @ARGV;
 
 
 if ($command eq "add") {
 if ($command eq "add") {
+    addConfig(@arguments);
+} elsif ($command eq "list") {
+    list();
 } elsif ($command eq "edit") {
 } elsif ($command eq "edit") {
 } elsif ($command eq "mount") {
 } elsif ($command eq "mount") {
 } elsif ($command eq "unmount") {
 } elsif ($command eq "unmount") {
@@ -55,3 +68,5 @@ if ($command eq "add") {
     usage();
     usage();
     exit 1;
     exit 1;
 }
 }
+
+DumpFile($configFile, $configData);