App-EmacsLockfileUtils

 view release on metacpan or  search on metacpan

script/emacs-lockfile-unlock  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /File/Lockfile/Emacs/emacs_lockfile_unlock
# and generated automatically using Perinci::CmdLine::Gen version 0.502

use 5.010001;
use strict;
use warnings;

use Perinci::CmdLine::Any;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2025-03-13'; # DATE
our $DIST = 'App-EmacsLockfileUtils'; # DIST
our $VERSION = '0.001'; # VERSION

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/File/Lockfile/Emacs/emacs_lockfile_unlock",
    program_name => "emacs-lockfile-unlock",
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: Unlock a file locked with Emacs-style lockfile
# PODNAME: emacs-lockfile-unlock

__END__

=pod

=encoding UTF-8

=head1 NAME

emacs-lockfile-unlock - Unlock a file locked with Emacs-style lockfile

=head1 VERSION

This document describes version 0.001 of emacs-lockfile-unlock (from Perl distribution App-EmacsLockfileUtils), released on 2025-03-13.

=head1 SYNOPSIS

B<emacs-lockfile-unlock> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<emacs-lockfile-unlock> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<emacs-lockfile-unlock> [B<L<--force|/"--force, -f">>|B<L<-f|/"--force, -f">>|B<L<--no-force|/"--force, -f">>|B<L<--noforce|/"--force, -f">>] [B<L<--format|/"--format=s">>=I<name>|B<L<--json|/"--json">>] [B<L<--(no)naked-res|/"--naked-res">>] [B<L<-...

=head1 DESCRIPTION

Note that there is a race condition between reading the lockfile and unlinking
it.

Will return 412 if target file does not exist (unless C<force> option is set to
true, in which case we proceed to unlocking anyway).

Will return 304 if target file is not currently locked using Emacs-style
lockfile.

Will return 500 if there's an error in reading the lockfile.

Will return 412 if we are not the same process that locks the file (unless
C<force> option is set to true, in which case we proceed to unlocking anyway).

Will return 500 if there's an error in removing the lockfile.

Will return 200 if everything goes ok.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--force>, B<-f>

(No description)


=item B<--target-file>=I<s>*

Target file.

Can also be specified as the 1st command-line argument.

=back

=head2 Output options

=over

=item B<--format>=I<s>

Choose output format, e.g. json, text.

Default value:

 undef

Output can be displayed in multiple formats, and a suitable default format is
chosen depending on the application and/or whether output destination is
interactive terminal (i.e. whether output is piped). This option specifically
chooses an output format.


=item B<--json>

Set output format to json.

=item B<--naked-res>

When outputing as JSON, strip result envelope.

Default value:



( run in 1.005 second using v1.01-cache-2.11-cpan-39bf76dae61 )