improve cred
[hband-tools.git] / tabdata / td-trans-mount
blob779667fc210969871ea04500b0ab550a2cad19f5
1 #!/usr/bin/env perl
4 =pod
6 =head1 NAME
8 td-trans-mount - Transform mount(1) output to tabular data stream.
10 =head1 DESCRIPTION
12 Supported mount(1) options which affect output format:
14 =over 4
16 =item -l (show labels)
18 =back
20 =head1 EXAMPLES
22 mount | td-trans-mount
24 mount -l | td-trans-mount
26 =cut
28 no if ($] >= 5.018), 'warnings' => 'experimental::smartmatch';
29 do '/usr/lib/tool/perl5/tabdata/common.pl' or die "$@";
31 @Headers = ("DEVICE", "MOUNTPOINT", "TYPE", "OPTIONS", "LABEL");
32 print join($FS, @Headers).$RS;
34 while(<STDIN>)
36 chomp;
38 if(/^(?<DEVICE>\S+) on (?<MOUNTPOINT>\S+) type (?<TYPE>\S+) \((?<OPTIONS>.*?)\)(?: \[(?<LABEL>.*?)\]|)$/)
40 @Fields = map {$+{$_}} @Headers;
41 print join($FS, @Fields).$RS;
43 else
45 die "can not parse: $line\n";