A utility to mark and operate on files in the shell.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

58 lines
1.0 KiB

#!/usr/bin/env perl
=pod
=head1 NAME
marks-add - add files to the current set of marked files
=head1 SYNOPSIS
marks-add: stashes a filesystem path for use with other utilities
USAGE:
marks add path_to_mark
EXAMPLE:
marks add *.txt
cd ~/notes
marks mv
=head1 AUTHOR
Brennen Bearnes
=cut
use warnings;
use strict;
use 5.10.0;
use App::MarkFiles qw(add);
use Cwd qw(cwd abs_path);
use Getopt::Long;
use Pod::Usage;
my $from_file;
GetOptions(
# 'config=s' => \$config_file,
'file|f' => \$from_file,
help => sub { pod2usage(0) },
) or pod2usage(2);
if ($from_file) {
# Use either the contents of files or standard input:
while (<>) {
chomp;
next unless length $_;
# TODO: This doesn't handle ~ expansion - use File::Glob?
# Not really a problem for things coming in as params
# from the shell, but it could well break user expectations
# in files.
add(abs_path($_));
}
} else {
# Use arguments as filenames to add:
add(map { abs_path($_) } @ARGV);
}