123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #!/usr/bin/env perl
- use strict;
- use warnings;
- # use YAML qw(LoadFile DumpFile);
- use YAML::Tiny;
- my $configFile = "$ENV{HOME}/.sshfs-helper";
- my $yaml
- my $configData;
- if ((not -e $configFile)) {
- YAML::Tiny->new({})->write($configFile);
- print "Create Config file, exiting."
- exit 1;
- } else {
- $yaml = YAML::Tiny->read($configFile);
- $configData = $yaml->[0];
- }
- sub mount {
-
- }
- sub unmount {
-
- }
- sub list {
- foreach my $name (keys %{$configData}) {
- print " - ${name}\n";
- }
- }
- sub usage {
- print "sshfs-helper [ list | mount name | unmount name | help ]\n";
- }
- sub help {
- usage();
- print <<EOF;
- EOF
- exit 1;
- }
- if (@ARGV == 0) {
- usage();
- exit 1;
- }
- my $command = shift @ARGV;
- my @arguments = @ARGV;
- if ($command eq "list") {
- list;
- } elsif ($command eq "mount") {
- mount shift @arguments;
- } elsif ($command eq "unmount") {
- unmount shift @arguments;
- } elsif ($command eq "help") {
- help;
- exit 1;
- } else {
- usage();
- exit 1;
- }
- $yaml->write($configFile);
- # DumpFile($configFile, $configData);
|