NAME
App::MarkFiles - some utility functions for marking and operating on files
SYNOPSIS
# This module:
use App::MarkFiles qw(get_dbh each_path add remove);
my $dbh = get_dbh(); # db handle for marks.db
add('/foo/bar', '/foo/baz');
remove('/foo/baz');
each_path(sub {
my ($path) = @_;
print "$path\n";
});
# mark commands:
$ mark add foo.txt
$ cd ~/somedir
$ mark mv
INSTALLING
$ perl Build.PL
$ ./Build
$ ./Build install
DESCRIPTION
The mark utilities store a list of marked file paths in marks.db in the user's home directory. Once marked, files can be copied, moved, listed, or passed as parameters to arbitrary shell commands.
This originated as a simple tool for collecting files from one or more directories and moving or copying them to another. A basic usage pattern looks something like this:
$ cd ~/screenshots
$ mark add foo.png
$ cd ~/blog/files/screenshots
$ mark mv
Moved: /home/brennen/screenshots/foo.png
This is more steps than a simple invocation of mv(1), but its utility becomes more apparent when it's combined with aliases for quickly navigating directories or invoked from other programs like editors and file managers.
See bin/mark
in this distribution (or, when installed, the mark(1) man page) for details on the commands.
SUBROUTINES
- get_dbh()
-
Get database handle for default marks database, stored in ~/marks.db.
Creates a new marks.db with the correct schema if one doesn't already exist.
- create_mark_db($dbh)
-
Create a new marks table.
- add(@paths)
-
Add a mark to one or more paths.
- remove(@paths)
-
Remove all given paths from the mark list.
- each_path($func)
-
Run an anonymous function against each item in the mark list.
Expects a sub which takes a path string.
AUTHOR
Copyright 2018 Brennen Bearnes
mark is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.