App-DesktopOpenUtils

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.023.
Changes
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
dist.ini
lib/App/DesktopOpenUtils.pm
script/open-desktop
t/00-compile.t
t/author-critic.t
t/author-pod-coverage.t
t/author-pod-syntax.t
t/release-rinci.t
weaver.ini

META.json  view on Meta::CPAN

      }
   },
   "version" : "0.002",
   "x_Dist_Zilla" : {
      "perl" : {
         "version" : "5.034000"
      },
      "plugins" : [
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript open-desktop",
            "version" : "0.423"
         },
         {
            "class" : "Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease",
            "name" : "@Author::PERLANCAR/PERLANCAR::CheckPendingRelease",
            "version" : "0.001"
         },
         {
            "class" : "Dist::Zilla::Plugin::GatherDir",
            "config" : {

META.yml  view on Meta::CPAN

  bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=App-DesktopOpenUtils
  homepage: https://metacpan.org/release/App-DesktopOpenUtils
  repository: git://github.com/perlancar/perl-App-DesktopOpenUtils.git
version: '0.002'
x_Dist_Zilla:
  perl:
    version: '5.034000'
  plugins:
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript open-desktop'
      version: '0.423'
    -
      class: Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease
      name: '@Author::PERLANCAR/PERLANCAR::CheckPendingRelease'
      version: '0.001'
    -
      class: Dist::Zilla::Plugin::GatherDir
      config:
        Dist::Zilla::Plugin::GatherDir:
          exclude_filename: []

Makefile.PL  view on Meta::CPAN

use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
  "ABSTRACT" => "Utilities related to Desktop::Open",
  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "App-DesktopOpenUtils",
  "EXE_FILES" => [
    "script/open-desktop"
  ],
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.010001",
  "NAME" => "App::DesktopOpenUtils",
  "PREREQ_PM" => {
    "Data::Sah::Compiler::perl::TH::array" => "0.910",
    "Data::Sah::Compiler::perl::TH::str" => "0.910",
    "Desktop::Open" => 0,
    "Log::ger" => "0.038",
    "Perinci::CmdLine::Any" => "0.152",

README  view on Meta::CPAN

    This document describes version 0.002 of App::DesktopOpenUtils (from
    Perl distribution App-DesktopOpenUtils), released on 2021-08-01.

SYNOPSIS
DESCRIPTION
    This distribution includes several utilities:

    #INSERT_EXECS_LIST

FUNCTIONS
  open_desktop
    Usage:

     open_desktop(%args) -> [$status_code, $reason, $payload, \%result_meta]

    This function is not exported.

    This function supports dry-run operation.

    Arguments ('*' denotes required arguments):

    *   paths_or_urls* => *array[str]*

    Special arguments:

dist.ini  view on Meta::CPAN

version=0.002

name=App-DesktopOpenUtils

[GenPericmdScript / GenPericmdScript open-desktop]
url=/App/DesktopOpenUtils/open_desktop
enable_log=1
default_log_level=info
read_config=0
read_env=0

[@Author::PERLANCAR]
:version=0.604

[Prereqs]
perl=5.010001

lib/App/DesktopOpenUtils.pm  view on Meta::CPAN

our $DIST = 'App-DesktopOpenUtils'; # DIST
our $VERSION = '0.002'; # VERSION

use 5.010001;
use strict;
use warnings;
use Log::ger;

our %SPEC;

$SPEC{open_desktop} = {
    v => 1.1,
    args => {
        paths_or_urls => {
            'x.name.is_plural' => 1,
            'x.name.singular' => 'path_or_url',
            schema => ['array*', of=>'str*'],
            req => 1,
            pos => 0,
            slurpy => 1,
        },
        #all => {
        #    schema => 'true*',
        #},
    },
    features => {
        dry_run => 1,
    },
};
sub open_desktop {
    require Desktop::Open;

    my %args = @_;
    for my $path_or_url (@{ $args{paths_or_urls} }) {
        if ($args{-dry_run}) {
            #my $cmd = $args{all} ?
            #    Browser::Open::open_browser_cmd_all() :
            #    Browser::Open::open_browser_cmd();
            #log_info "[DRY_RUN] Opening %s in browser with: %s ...", $url, $cmd;
            #log_info "[DRY_RUN] Opening %s ...", $path_or_url;
        } else {
            log_trace "Opening %s ...", $path_or_url;
            #Desktop::Open::open_desktop($url, $args{all});
            Desktop::Open::open_desktop($path_or_url);
        }
    }
    [200];
}

1;
# ABSTRACT: Utilities related to Desktop::Open

__END__

lib/App/DesktopOpenUtils.pm  view on Meta::CPAN


=head1 DESCRIPTION

This distribution includes several utilities:

#INSERT_EXECS_LIST

=head1 FUNCTIONS


=head2 open_desktop

Usage:

 open_desktop(%args) -> [$status_code, $reason, $payload, \%result_meta]

This function is not exported.

This function supports dry-run operation.


Arguments ('*' denotes required arguments):

=over 4

script/open-desktop  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/DesktopOpenUtils/open_desktop
# and generated automatically using Perinci::CmdLine::Gen version 0.499

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2021-08-01'; # DATE
our $DIST = 'App-DesktopOpenUtils'; # DIST
our $VERSION = '0.002'; # VERSION

use 5.010001;
use strict;
use warnings;
use Log::ger;

use Perinci::CmdLine::Any;

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/DesktopOpenUtils/open_desktop",
    program_name => "open-desktop",
    log => 1,
    log_level => "info",
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: open-desktop
# PODNAME: open-desktop

__END__

=pod

=encoding UTF-8

=head1 NAME

open-desktop - open-desktop

=head1 VERSION

This document describes version 0.002 of open-desktop (from Perl distribution App-DesktopOpenUtils), released on 2021-08-01.

=head1 SYNOPSIS

Usage:

% B<open-desktop> [B<--debug>|B<--log-level>=I<level>|B<--quiet>|B<--trace>|B<--verbose>] [B<--dry-run>|B<-n>] [B<--format>=I<name>|B<--json>] [B<--(no)naked-res>] [B<--page-result>[=I<program>]|B<--view-result>[=I<program>]] [(B<--path-or-url>=I<str...

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--path-or-url>=I<s@>*

script/open-desktop  view on Meta::CPAN


=head1 COMPLETION

This script has shell tab completion capability with support for several
shells.

=head2 bash

To activate bash completion for this script, put:

 complete -C open-desktop open-desktop

in your bash startup (e.g. F<~/.bashrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is recommended, however, that you install modules using L<cpanm-shcompgen>
which can activate shell completion for scripts immediately.

=head2 tcsh

To activate tcsh completion for this script, put:

 complete open-desktop 'p/*/`open-desktop`/'

in your tcsh startup (e.g. F<~/.tcshrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is also recommended to install L<shcompgen> (see above).

=head2 other shells

For fish and zsh, install L<shcompgen> as described above.

t/00-compile.t  view on Meta::CPAN


use Test::More;

plan tests => 2 + ($ENV{AUTHOR_TESTING} ? 1 : 0);

my @module_files = (
    'App/DesktopOpenUtils.pm'
);

my @scripts = (
    'script/open-desktop'
);

# no fake home requested

my @switches = (
    -d 'blib' ? '-Mblib' : '-Ilib',
);

use File::Spec;
use IPC::Open3;

t/author-critic.t  view on Meta::CPAN

}


use strict;
use warnings;

# this test was generated with Dist::Zilla::Plugin::Test::Perl::Critic::Subset 3.001.005

use Test::Perl::Critic (-profile => "") x!! -e "";

my $filenames = ['lib/App/DesktopOpenUtils.pm','script/open-desktop'];
unless ($filenames && @$filenames) {
    $filenames = -d "blib" ? ["blib"] : ["lib"];
}

all_critic_ok(@$filenames);



( run in 0.484 second using v1.01-cache-2.11-cpan-299005ec8e3 )