瀏覽代碼

More work on the sshfs helper

Samuel W. Flint 7 年之前
父節點
當前提交
259189f855
共有 1 個文件被更改,包括 17 次插入2 次删除
  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);