mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-08 05:15:10 +00:00
ae5e229735
git-svn-id: https://svn.fhem.de/fhem/trunk@19004 2b470e98-0d58-463d-a4d8-8e2adae1ed80
124 lines
2.8 KiB
Perl
Executable File
124 lines
2.8 KiB
Perl
Executable File
# $Id$
|
|
|
|
package main;
|
|
use strict;
|
|
use warnings;
|
|
use FHEM::Meta;
|
|
|
|
sub search_Initialize($$) {
|
|
my ($modHash) = @_;
|
|
my %hash = (
|
|
Fn => "FHEM::search::run",
|
|
Hlp => "<search expression>",
|
|
);
|
|
$cmds{search} = \%hash;
|
|
|
|
return FHEM::Meta::InitMod( __FILE__, $modHash );
|
|
}
|
|
|
|
# define package
|
|
package FHEM::search;
|
|
use strict;
|
|
use warnings;
|
|
use POSIX;
|
|
|
|
use GPUtils qw(GP_Import);
|
|
|
|
# Run before module compilation
|
|
BEGIN {
|
|
# Import from main::
|
|
GP_Import(
|
|
qw(
|
|
modules
|
|
defs
|
|
fhem
|
|
)
|
|
);
|
|
}
|
|
|
|
sub run {
|
|
my ( $cl, $search ) = @_;
|
|
my $hash;
|
|
my $name = 'fhemInstaller';
|
|
if ( defined( $modules{Installer} )
|
|
&& defined( $modules{Installer}{defptr} )
|
|
&& defined( $modules{Installer}{defptr}{localhost} ) )
|
|
{
|
|
$hash = $modules{Installer}{defptr}{localhost};
|
|
}
|
|
else {
|
|
my $no = 1;
|
|
my $newname = $name;
|
|
while ( defined( $defs{$newname} ) ) {
|
|
$newname = $name . $no++;
|
|
}
|
|
fhem "define $newname Installer";
|
|
$hash = $modules{Installer}{defptr}{localhost};
|
|
}
|
|
|
|
return 'Not a hash reference: ' unless ( $hash && ref($hash) eq 'HASH' );
|
|
$name = $hash->{NAME};
|
|
|
|
$hash->{CL} = $cl if ($cl);
|
|
my $ret = FHEM::Installer::Get( $hash, $name, 'search', $search );
|
|
delete $hash->{CL} if ($cl);
|
|
return $ret;
|
|
}
|
|
|
|
1;
|
|
|
|
=pod
|
|
=encoding utf8
|
|
=item command
|
|
=item summary Search through this FHEM instance
|
|
=item summary_DE Durchsucht die FHEM Instanz
|
|
|
|
=begin html
|
|
|
|
<a name="search"></a>
|
|
<h3>search</h3>
|
|
<ul>
|
|
<code>search <search expression></code>
|
|
<br />
|
|
Searches FHEM for devices, modules, developer packages, keywords, authors/maintainers and Perl packages.<br />
|
|
This command requires a device instance of the FHEM Installer module. If no local Installer device is present,
|
|
the first run of this command will create one.<br />
|
|
<br />
|
|
Have a look to the 'Get search' command of the FHEM Installer to learn more about how to search.
|
|
</ul>
|
|
|
|
=end html
|
|
|
|
=begin html_DE
|
|
|
|
<a name="search"></a>
|
|
<h3>search</h3>
|
|
<ul>
|
|
<code>search <Suchausdruck></code>
|
|
<br />
|
|
Durchsucht FHEM nach Geräten, Modulen, Entwickler Paketen, Schlüsselwörtern und Perl Paketen.<br />
|
|
Dieses Kommando benötigt eine Geräteinstanz des FHEM Installer Moduls. Sofern kein lokales Installer Gerät
|
|
vorhanden ist, wird beim ersten ausführen dieses Kommandos eines angelegt.<br />
|
|
<br />
|
|
Das 'Get search' Kommando des FHEM Installer verrät mehr daräber, wie die Suche funktioniert.
|
|
</ul>
|
|
|
|
=end html_DE
|
|
|
|
=for :application/json;q=META.json 98_search.pm
|
|
{
|
|
"version": "v0.9.0",
|
|
"author": [
|
|
"Julian Pawlowski <julian.pawlowski@gmail.com>"
|
|
],
|
|
"x_fhem_maintainer": [
|
|
"loredo"
|
|
],
|
|
"x_fhem_maintainer_github": [
|
|
"jpawlowski"
|
|
]
|
|
}
|
|
=end :application/json;q=META.json
|
|
|
|
=cut
|