Browse Source

More work on the sshfs helper

Samuel W. Flint 8 years ago
parent
commit
259189f855
1 changed files with 17 additions and 2 deletions
  1. 17 2
      sshfs-helper

+ 17 - 2
sshfs-helper

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